[8] ErrorException in News.php line 24

Trying to access array offset on value of type null

  1. {
  2. $classid = input('get.classid');
  3. // 当前栏目信息
  4. $newsClass = Db::name('nav')->field('title,url,parentid')->where("id=$classid")->select();
  5. $this->assign('newsClass',$newsClass);
  6. // 父级栏目信息
  7. $parentid = $newsClass[0]['parentid'];
  8. $parentClass = Db::name('nav')->field('title,url,parentid')->where("id=$parentid")->find();
  9. $parentName = $parentClass['title'];
  10. $this->assign('parentName',$parentName);
  11. // 新闻分页
  12. $where['query']['classid'] = $classid;
  13. $newsList = Db::name('article')->where(['status' => 1,'classid' => $classid])->order('create_time desc,istop desc,orderid asc,create_time desc')->paginate(10,'',$where);
  14. $this->assign('newsList',$newsList);
  15. return $this->fetch();
  16. }

Call Stack

  1. in News.php line 24
  2. at Error::appError(8, 'Trying to access arr...', '/alidata/www/stock/a...', 24, ['classid' => '49', 'newsClass' => [['title' => '企业文化', 'url' => 'index/qiye/index', 'parentid' => 0]], 'parentid' => 0, ...]) in News.php line 24
  3. at News->newslist()
  4. at ReflectionMethod->invokeArgs(object(News), []) in App.php line 234
  5. at App::invokeMethod([object(News), 'newslist'], []) in App.php line 401
  6. at App::module(['index', 'news', 'newslist'], ['app_namespace' => 'app', 'app_debug' => true, 'app_trace' => false, ...], true) in App.php line 140
  7. at App::run() in start.php line 18
  8. at require('/alidata/www/stock/t...') in index.php line 24

Exception Datas

Error Context
classid 49
newsClass [ { "title": "\u4f01\u4e1a\u6587\u5316", "url": "index\/qiye\/index", "parentid": 0 } ]
parentid 0
parentClass Resource

Environment Variables

GET Data
classid 49
POST Dataempty
Filesempty
Cookies
PHPSESSID c3191bcc931d1fb3ad1e6aeeb427b91f
Sessionempty
Server/Request Data
REDIRECT_STATUS 200
HTTP_USER_AGENT Mozilla/5.0 (compatible; AhrefsBot/7.0; +http://ahrefs.com/robot/)
HTTP_HOST www.zyddcm.com
HTTP_ACCEPT */*
HTTP_ACCEPT_ENCODING gzip
HTTP_COOKIE PHPSESSID=c3191bcc931d1fb3ad1e6aeeb427b91f
PATH /sbin:/usr/sbin:/bin:/usr/bin
LD_LIBRARY_PATH /alidata/server/httpd/lib
SERVER_SIGNATURE
SERVER_SOFTWARE Apache/2.4.2 (Unix) PHP/7.4.28
SERVER_NAME www.zyddcm.com
SERVER_ADDR 10.100.10.9
SERVER_PORT 80
REMOTE_ADDR 104.206.1.218
DOCUMENT_ROOT /alidata/www/stock
REQUEST_SCHEME http
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT /alidata/www/stock
SERVER_ADMIN you@example.com
SCRIPT_FILENAME /alidata/www/stock/index.php
REMOTE_PORT 51674
REDIRECT_QUERY_STRING s=index/news/newslist&classid=49
REDIRECT_URL /index/news/newslist
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD GET
QUERY_STRING s=index/news/newslist&classid=49
REQUEST_URI //index/news/newslist?classid=49
SCRIPT_NAME /index.php
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1664131164.6026
REQUEST_TIME 1664131164
argv [ "s=index\/news\/newslist&classid=49" ]
argc 1
PATH_INFO index/news/newslist
Environment Variables
TERM xterm
SYSTEMCTL_SKIP_REDIRECT
LD_LIBRARY_PATH /alidata/server/httpd/lib
PATH /sbin:/usr/sbin:/bin:/usr/bin
PWD /
SHLVL 1
SYSTEMCTL_IGNORE_DEPENDENCIES
_ /alidata/server/httpd/bin/httpd
ThinkPHP Constants
APP_PATH /alidata/www/stock/application/
APP_DEBUG true
THINK_VERSION 5.0.4
THINK_START_TIME 1664131164.6036
THINK_START_MEM 400352
EXT .php
DS /
THINK_PATH /alidata/www/stock/thinkphp/
LIB_PATH /alidata/www/stock/thinkphp/library/
CORE_PATH /alidata/www/stock/thinkphp/library/think/
TRAIT_PATH /alidata/www/stock/thinkphp/library/traits/
ROOT_PATH /alidata/www/stock/
EXTEND_PATH /alidata/www/stock/extend/
VENDOR_PATH /alidata/www/stock/vendor/
RUNTIME_PATH /alidata/www/stock/runtime/
LOG_PATH /alidata/www/stock/runtime/log/
CACHE_PATH /alidata/www/stock/runtime/cache/
TEMP_PATH /alidata/www/stock/runtime/temp/
CONF_PATH /alidata/www/stock/application/
CONF_EXT .php
ENV_PREFIX PHP_
IS_CLI false
IS_WIN false