[8] ErrorException in News.php line 61

未定义数组索引: category_id

  1. public function detail($id=Null){
  2. if(!$id) $this->error('文章不存在');
  3. $info = Article::get($id);
  4. if($info['views'] < 100){
  5. $add = rand(100,150);
  6. $info['views'] = $add;
  7. }else{
  8. $add = rand(1,3);
  9. }
  10. $breadcrumb = breadcrumb($info['category_id']);
  11. $active = count($breadcrumb)>1?$breadcrumb['parent']['id']:$id;
  12. Article::where('id',$id)->inc('views',$add)->update();
  13. $subject = strip_tags($info['content']);//去除html标签
  14. $pattern = '/\s/';//去除空白
  15. $content = preg_replace($pattern, '', $subject);
  16. $desc = mb_substr($content, 0, 40,"UTF-8"); //截取40个汉字
  17. $this->assign([
  18. 'description'=>$desc,

Call Stack

  1. in News.php line 61
  2. at Error::appError(8, 'Undefined index: cat...', '/www/sites/www.xjcia...', 61, ['id' => '282', 'info' => ['views' => 101], 'add' => 101]) in News.php line 61
  3. at News->detail('282')
  4. at ReflectionMethod->invokeArgs(object(News), ['282']) in App.php line 343
  5. at App::invokeMethod([object(News), 'detail'], []) in App.php line 611
  6. at App::module(['index', 'News', 'detail'], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], false) in App.php line 456
  7. at App::exec(['type' => 'module', 'module' => ['index', 'News', 'detail'], 'convert' => false], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 139
  8. at App::run() in start.php line 19
  9. at require('/www/sites/www.xjcia...') in index.php line 23

Environment Variables

GET Data
empty
POST Data
empty
Files
empty
Cookies
empty
Session
empty

Server/Request Data

HOSTNAME
11499c58d397
PHP_INI_DIR
/usr/local/etc/php
SHLVL
1
HOME
/home/www-data
PHP_LDFLAGS
-Wl,-O1 -pie
PHP_CFLAGS
-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
PHP_VERSION
7.3.33
COMPOSER_HOME
/tmp/composer
GPG_KEYS
CBAF69F173A0FEA4B537F470D66C9593118BCCB6 F38252826ACD957EF380D39F2F7956BC5DA04B5D
PHP_CPPFLAGS
-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
PHP_ASC_URL
https://www.php.net/distributions/php-7.3.33.tar.xz.asc
PHP_URL
https://www.php.net/distributions/php-7.3.33.tar.xz
PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LD_PRELOAD
/usr/lib/preloadable_libiconv.so php
PHPIZE_DEPS
autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c
PWD
/www
PHP_SHA256
166eaccde933381da9516a2b70ad0f447d7cec4b603d07b9a916032b215b90cc
USER
www-data
HTTP_REFERER
http://www.xjcia.cn/detail/282
HTTP_USER_AGENT
claudebot
HTTP_ACCEPT
*/*
HTTP_HOST
www.xjcia.cn
SCRIPT_FILENAME
/www/sites/www.xjcia.cn/index/public/index.php
REDIRECT_STATUS
200
SERVER_NAME
www.xjcia.cn
SERVER_PORT
443
SERVER_ADDR
172.16.0.8
REMOTE_PORT
49382
REMOTE_ADDR
44.220.131.93
SERVER_SOFTWARE
nginx
GATEWAY_INTERFACE
CGI/1.1
HTTPS
on
REQUEST_SCHEME
https
SERVER_PROTOCOL
HTTP/2.0
DOCUMENT_ROOT
/www/sites/www.xjcia.cn/index/public
DOCUMENT_URI
/index.php
REQUEST_URI
/detail/282
SCRIPT_NAME
/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD
GET
QUERY_STRING
s=/detail/282
FCGI_ROLE
RESPONDER
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1711651498.5006
REQUEST_TIME
1711651498
PATH_INFO
/detail/282
Environment Variables
empty

ThinkPHP Constants

APP_PATH
/www/sites/www.xjcia.cn/index/public/../application/
THINK_VERSION
5.0.23
THINK_START_TIME
1711651498.5009
THINK_START_MEM
408640
EXT
.php
DS
/
THINK_PATH
/www/sites/www.xjcia.cn/index/thinkphp/
LIB_PATH
/www/sites/www.xjcia.cn/index/thinkphp/library/
CORE_PATH
/www/sites/www.xjcia.cn/index/thinkphp/library/think/
TRAIT_PATH
/www/sites/www.xjcia.cn/index/thinkphp/library/traits/
ROOT_PATH
/www/sites/www.xjcia.cn/index/
EXTEND_PATH
/www/sites/www.xjcia.cn/index/extend/
VENDOR_PATH
/www/sites/www.xjcia.cn/index/vendor/
RUNTIME_PATH
/www/sites/www.xjcia.cn/index/runtime/
LOG_PATH
/www/sites/www.xjcia.cn/index/runtime/log/
CACHE_PATH
/www/sites/www.xjcia.cn/index/runtime/cache/
TEMP_PATH
/www/sites/www.xjcia.cn/index/runtime/temp/
CONF_PATH
/www/sites/www.xjcia.cn/index/public/../application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false
ADDON_PATH
/www/sites/www.xjcia.cn/index/addons/