#0 [2]ErrorException in Category.php line 27

Attempt to read property "mod_id" on null

  1. protected $categoryid;
  2. protected $mod;
  3. protected $table;
  4. public function initialize()
  5. {
  6. parent::initialize();
  7. $this->categoryid = $this->request->param('category_id');
  8. $this->category = \app\common\model\Category::find($this->categoryid);
  9. $modid = $this->category->mod_id;
  10. if (!$modid) {
  11. $this->error('模型ID错误');
  12. }
  13. $this->mod = \app\common\model\Mod::find($modid);
  14. $this->table = $this->mod->getMod();
  15. }
  16. public function index($CategoryId)
  17. {

Call Stack

  1. in Category.php line 27
  2. at Error->appError() in Category.php line 27
  3. at Category->initialize() in BaseController.php line 50
  4. at BaseController->__construct()
  5. at ReflectionClass->newInstanceArgs() in Container.php line 396
  6. at Container->invokeClass() in Container.php line 253
  7. at Container->make() in Controller.php line 187
  8. at Controller->controller() in Controller.php line 74
  9. at Controller->exec() in Dispatch.php line 52
  10. at Dispatch->run() in Route.php line 755
  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 756
  14. at Route->dispatch() in Http.php line 208
  15. at Http->dispatchToRoute() in Http.php line 198
  16. at Http->think\{closure}() in Pipeline.php line 59
  17. at Pipeline->think\{closure}() in MultiApp.php line 51
  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 52
  21. at MultiApp->handle()
  22. at call_user_func() in Middleware.php line 134
  23. at Middleware->think\{closure}() in Pipeline.php line 85
  24. at Pipeline->think\{closure}() in Auth.php line 26
  25. at Auth->handle()
  26. at call_user_func() in Middleware.php line 134
  27. at Middleware->think\{closure}() in Pipeline.php line 85
  28. at Pipeline->think\{closure}() in AllowCrossDomain.php line 61
  29. at AllowCrossDomain->handle()
  30. at call_user_func() in Middleware.php line 134
  31. at Middleware->think\{closure}() in Pipeline.php line 85
  32. at Pipeline->think\{closure}() in SessionInit.php line 58
  33. at SessionInit->handle()
  34. at call_user_func() in Middleware.php line 134
  35. at Middleware->think\{closure}() in Pipeline.php line 85
  36. at Pipeline->think\{closure}() in TraceDebug.php line 71
  37. at TraceDebug->handle()
  38. at call_user_func() in Middleware.php line 134
  39. at Middleware->think\{closure}() in Pipeline.php line 85
  40. at Pipeline->think\{closure}() in Pipeline.php line 66
  41. at Pipeline->then() in Http.php line 199
  42. at Http->runWithRequest() in Http.php line 162
  43. at Http->run() in index.php line 21

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
HTTP_HOST www.bnxf.net
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME www.bnxf.net
SERVER_PORT 443
SERVER_ADDR 10.0.16.13
REMOTE_PORT 46272
REMOTE_ADDR 54.196.114.118
SERVER_SOFTWARE nginx/1.20.1
GATEWAY_INTERFACE CGI/1.1
HTTPS on
REQUEST_SCHEME https
SERVER_PROTOCOL HTTP/2.0
DOCUMENT_ROOT /www/wwwroot/www.bnxf.net/public
DOCUMENT_URI /index.php
REQUEST_URI /category/1.html
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=/category/1.html
SCRIPT_FILENAME /www/wwwroot/www.bnxf.net/public/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711700331.1674
REQUEST_TIME 1711700331
0.105724s