#0 [2]ErrorException in Goods.php line 14

Trying to access array offset on value of type null

  1. use think\facade\Db;
  2. class Goods extends BaseController
  3. {
  4. public function index($id=0)
  5. {
  6. if($id==0){
  7. return redirect('/');
  8. }
  9. $goods = Db::table('goods')->where('goods_id', $id)->find();
  10. $goods['goods_image']=json_decode($goods['goods_image'],true);
  11. $tmp = Db::table('goods_language')->where('goods_id', $id)->where('language_id', $GLOBALS['language_id'])->column('language_value', 'language_key');
  12. $goods = array_merge($goods, $tmp);
  13. $goods['tag']=explode(',',$goods['tag']);
  14. if(!empty($goods['extra_title'])){$goods['extra_title']=json_decode($goods['extra_title'],true);}else{$goods['extra_title']=array();}
  15. if(!empty($goods['extra_content'])){$goods['extra_content']=json_decode($goods['extra_content'],true);}else{$goods['extra_content']=array();}
  16. if(!empty($goods['price_include'])){$goods['price_include']=json_decode($goods['price_include'],true);}else{$goods['price_include']=array();}
  17. if(!empty($goods['price_exclude'])){$goods['price_exclude']=json_decode($goods['price_exclude'],true);}else{$goods['price_exclude']=array();}
  18. if(!empty($goods['price_prohibit'])){$goods['price_prohibit']=json_decode($goods['price_prohibit'],true);}else{$goods['price_prohibit']=array();}
  19. if($goods['goods_calendar'])

Call Stack

  1. in Goods.php line 14
  2. at Error->appError(2, 'Trying to access arr...', '/var/www/html/go2tai...', 14) in Goods.php line 14
  3. at Goods->index('248')
  4. at ReflectionMethod->invokeArgs(object(Goods), ['248']) in Container.php line 343
  5. at Container->invokeReflectMethod(object(Goods), object(ReflectionMethod), ['id' => '248']) in Controller.php line 110
  6. at Controller->think\route\dispatch\{closure}(object(Request)) in Pipeline.php line 59
  7. at Pipeline->think\{closure}(object(Request)) in Pipeline.php line 66
  8. at Pipeline->then(object(Closure)) 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}(object(Request)) in Pipeline.php line 59
  12. at Pipeline->think\{closure}(object(Request)) in Pipeline.php line 66
  13. at Pipeline->then(object(Closure)) in Route.php line 773
  14. at Route->dispatch(object(Request), object(Closure)) in Http.php line 216
  15. at Http->dispatchToRoute(object(Request)) in Http.php line 206
  16. at Http->think\{closure}(object(Request)) in Pipeline.php line 59
  17. at Pipeline->think\{closure}(object(Request)) in MultiApp.php line 71
  18. at MultiApp->think\app\{closure}(object(Request)) in Pipeline.php line 59
  19. at Pipeline->think\{closure}(object(Request)) in Auth.php line 25
  20. at Auth->handle(object(Request), object(Closure))
  21. at call_user_func([object(Auth), 'handle'], object(Request), object(Closure)) in Middleware.php line 142
  22. at Middleware->think\{closure}(object(Request), object(Closure)) in Pipeline.php line 85
  23. at Pipeline->think\{closure}(object(Request)) in Pipeline.php line 66
  24. at Pipeline->then(object(Closure)) in MultiApp.php line 72
  25. at MultiApp->handle(object(Request), object(Closure))
  26. at call_user_func([object(MultiApp), 'handle'], object(Request), object(Closure)) in Middleware.php line 142
  27. at Middleware->think\{closure}(object(Request), object(Closure)) in Pipeline.php line 85
  28. at Pipeline->think\{closure}(object(Request)) in SessionInit.php line 67
  29. at SessionInit->handle(object(Request), object(Closure))
  30. at call_user_func([object(SessionInit), 'handle'], object(Request), object(Closure)) in Middleware.php line 142
  31. at Middleware->think\{closure}(object(Request), object(Closure)) in Pipeline.php line 85
  32. at Pipeline->think\{closure}(object(Request)) in TraceDebug.php line 71
  33. at TraceDebug->handle(object(Request), object(Closure))
  34. at call_user_func([object(TraceDebug), 'handle'], object(Request), object(Closure)) in Middleware.php line 142
  35. at Middleware->think\{closure}(object(Request), object(Closure)) in Pipeline.php line 85
  36. at Pipeline->think\{closure}(object(Request)) in Pipeline.php line 66
  37. at Pipeline->then(object(Closure)) in Http.php line 207
  38. at Http->runWithRequest(object(Request)) in Http.php line 170
  39. at Http->run() in index.php line 20

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER apache
HOME /usr/share/httpd
PATH_TRANSLATED redirect:/index.php/goods/248.html/248.html
PATH_INFO /goods/248.html
SCRIPT_NAME /index.php
REQUEST_URI /goods/248.html
QUERY_STRING
REQUEST_METHOD GET
SERVER_PROTOCOL HTTP/1.1
GATEWAY_INTERFACE CGI/1.1
REDIRECT_URL /goods/248.html
REMOTE_PORT 13128
SCRIPT_FILENAME /var/www/html/go2taiwan/public/index.php
SERVER_ADMIN root@localhost
CONTEXT_DOCUMENT_ROOT /var/www/html/go2taiwan/public
CONTEXT_PREFIX
REQUEST_SCHEME https
DOCUMENT_ROOT /var/www/html/go2taiwan/public
REMOTE_ADDR 172.68.118.98
SERVER_PORT 443
SERVER_ADDR 172.104.73.247
SERVER_NAME www.go2taiwan.com
SERVER_SOFTWARE Apache/2.4.37 (CentOS Stream) OpenSSL/1.1.1k
SERVER_SIGNATURE
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
HTTP_CF_IPCOUNTRY US
HTTP_CDN_LOOP cloudflare
HTTP_CF_CONNECTING_IP 34.230.84.106
HTTP_REFERER http://go2taiwan.com/goods/248.html
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
HTTP_CF_VISITOR {"scheme":"https"}
HTTP_X_FORWARDED_PROTO https
HTTP_CF_RAY 866cf2d4ebe63b17-NRT
HTTP_X_FORWARDED_FOR 34.230.84.106
HTTP_ACCEPT_ENCODING gzip, br
HTTP_CONNECTION Keep-Alive
HTTP_HOST www.go2taiwan.com
proxy-nokeepalive 1
SSL_TLS_SNI www.go2taiwan.com
HTTPS on
UNIQUE_ID Zflv32Bnq4imwG6jGVZhnwAAANI
REDIRECT_STATUS 200
REDIRECT_SSL_TLS_SNI www.go2taiwan.com
REDIRECT_HTTPS on
REDIRECT_UNIQUE_ID Zflv32Bnq4imwG6jGVZhnwAAANI
FCGI_ROLE RESPONDER
PHP_SELF /index.php/goods/248.html
REQUEST_TIME_FLOAT 1710845919.6102
REQUEST_TIME 1710845919
0.023955s