#0 [8]ErrorException in Article.php line 146

Trying to access array offset on value of type null

  1. public function category($ename)
  2. {
  3. $ModelCategory = new ContentCategory();
  4. $ModelArticle = new ContentArticle();
  5. $category = $ModelCategory->where('ename|id', $ename)->find();
  6. $articleRes = $ModelArticle
  7. ->where([
  8. ['status', '=', 1],
  9. ['category_id', '=', $category['id']],
  10. ])
  11. ->with(['mp'])
  12. ->order('newsdate_time desc')
  13. ->paginate(12);
  14. //文章
  15. $moreArticleRes = [
  16. //最新
  17. 'new' => $ModelArticle
  18. ->where(['status' => 1])

Call Stack

  1. in Article.php line 146
  2. at Error->appError() in Article.php line 146
  3. at Article->category()
  4. at ReflectionMethod->invokeArgs() in Container.php line 343
  5. at Container->invokeReflectMethod() in Controller.php line 110
  6. at Controller->think\route\dispatch\{closure}() in Pipeline.php line 59
  7. at Pipeline->think\{closure}() in Pipeline.php line 66
  8. at Pipeline->then() in Controller.php line 113
  9. at Controller->exec() in Dispatch.php line 89
  10. at Dispatch->run() in Route.php line 772
  11. at Route->think\{closure}() in Pipeline.php line 59
  12. at Pipeline->think\{closure}() in Pipeline.php line 66
  13. at Pipeline->then() in Route.php line 773
  14. at Route->dispatch() in Http.php line 216
  15. at Http->dispatchToRoute() in Http.php line 206
  16. at Http->think\{closure}() in Pipeline.php line 59
  17. at Pipeline->think\{closure}() in MultiApp.php line 71
  18. at MultiApp->think\app\{closure}() in Pipeline.php line 59
  19. at Pipeline->think\{closure}() in Pipeline.php line 66
  20. at Pipeline->then() in MultiApp.php line 72
  21. at MultiApp->handle()
  22. at call_user_func() in Middleware.php line 142
  23. at Middleware->think\{closure}() in Pipeline.php line 85
  24. at Pipeline->think\{closure}() in TraceDebug.php line 71
  25. at TraceDebug->handle()
  26. at call_user_func() in Middleware.php line 142
  27. at Middleware->think\{closure}() in Pipeline.php line 85
  28. at Pipeline->think\{closure}() in Pipeline.php line 66
  29. at Pipeline->then() in Http.php line 207
  30. at Http->runWithRequest() in Http.php line 170
  31. at Http->run() in index.php line 20

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Session
websiteInfo { "id": 1 }
Server/Request Data
USER www
HOME /home/www
HTTP_X_TENCENT_UA Qcloud
HTTP_45268EDD92E0E26F864D7363BA93A1A5 tag
HTTP_X_NWS_LOG_UUID 7427016837154299963
HTTP_3A224235662EB0FB2435720004AC5510 tag
HTTP_TENCENT_ACCELERATION_DOMAIN_NAME www.jianchizhai.com
HTTP_X_FORWARDED_PROTO https
HTTP_X_LEGO_VIA 200488
HTTP_X_FORWARDED_FOR 54.210.126.232
HTTP_CONNECTION keep-alive
HTTP_82279E11278F7DE66670F659B3C46FFB tag
HTTP_HOST www.jianchizhai.com
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME wenyu.jianchizhai.com
SERVER_PORT 443
SERVER_ADDR 172.21.0.6
REMOTE_PORT 35151
REMOTE_ADDR 113.219.202.173
SERVER_SOFTWARE nginx/1.20.1
GATEWAY_INTERFACE CGI/1.1
HTTPS on
REQUEST_SCHEME https
SERVER_PROTOCOL HTTP/1.1
DOCUMENT_ROOT /www/wwwroot/jianchizhai_wenyu/v2.0.0/public
DOCUMENT_URI /index.php
REQUEST_URI /category/literature.html
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=/category/literature.html
SCRIPT_FILENAME /www/wwwroot/jianchizhai_wenyu/v2.0.0/public/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711633083.0195
REQUEST_TIME 1711633083