#0 [8]ErrorException in Index.php line 105

Trying to access array offset on value of type null

  1. return $this->fetch();
  2. }
  3. public function newsDetail(){
  4. $param = input('param.');
  5. $id = $param['id'];
  6. $info = Db::name('news_product')->where('id',$id)->find();
  7. $info['date'] = date('Y-m-d H:i:s',$info['create_time']);
  8. $randList = Db::name('news_product')->where('id != '.$id.' and cate_id = 13')->orderRaw('rand()')->limit(3)->field('id,title,images,desc,create_time')->select()->toArray();
  9. //上一条
  10. $prev_id = Db::name('news_product')->where("id < ".$info['id']." and cate_id = 13")->max('id');
  11. if ($prev_id != 0){
  12. $prev_data = Db::name('news_product')->where(['id' => $prev_id])->field('id,title')->find();
  13. }else{
  14. $prev_data = '';
  15. }
  16. //下一条

Call Stack

  1. in Index.php line 105
  2. at Error->appError() in Index.php line 105
  3. at Index->newsDetail()
  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 SessionInit.php line 67
  18. at SessionInit->handle()
  19. at call_user_func() in Middleware.php line 142
  20. at Middleware->think\{closure}() in Pipeline.php line 85
  21. at Pipeline->think\{closure}() in LoadLangPack.php line 59
  22. at LoadLangPack->handle()
  23. at call_user_func() in Middleware.php line 142
  24. at Middleware->think\{closure}() in Pipeline.php line 85
  25. at Pipeline->think\{closure}() in MultiApp.php line 71
  26. at MultiApp->think\app\{closure}() in Pipeline.php line 59
  27. at Pipeline->think\{closure}() in Pipeline.php line 66
  28. at Pipeline->then() in MultiApp.php line 72
  29. at MultiApp->handle()
  30. at call_user_func() in Middleware.php line 142
  31. at Middleware->think\{closure}() in Pipeline.php line 85
  32. at Pipeline->think\{closure}() in Pipeline.php line 66
  33. at Pipeline->then() in Http.php line 207
  34. at Http->runWithRequest() in Http.php line 170
  35. at Http->run() in index.php line 24

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
HTTP_REFERER http://www.zhongaowood.com/news/134.html
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
HTTP_HOST www.zhongaowood.com
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME www.zhongaowood.com
SERVER_PORT 443
SERVER_ADDR 172.19.10.105
REMOTE_PORT 45878
REMOTE_ADDR 54.235.6.60
SERVER_SOFTWARE nginx/1.22.1
GATEWAY_INTERFACE CGI/1.1
HTTPS on
REQUEST_SCHEME https
SERVER_PROTOCOL HTTP/2.0
DOCUMENT_ROOT /www/wwwroot/www.zhongaowood.com/public
DOCUMENT_URI /index.php
REQUEST_URI /news/134.html
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=/news/134.html
SCRIPT_FILENAME /www/wwwroot/www.zhongaowood.com/public/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1710835399.6903
REQUEST_TIME 1710835399