[2] ErrorException in Goods.php line 364

Invalid argument supplied for foreach()

  1. public function detail()
  2. {
  3. $url = $this->request->param('id', 0);
  4. //blog
  5. $good = g::getByUrl($url);
  6. $good['goodsSpecs'] = $good->goodsSpecs;
  7. $key_sp = [];
  8. $value = [];
  9. foreach ($good['goodsSpecs'] as &$v) {
  10. $v['good_specs'] = json_decode($v['good_specs'], true);
  11. foreach ($v['good_specs'] as $ks => &$vs) {
  12. if (!in_array($ks, $key_sp)) {
  13. // $key_sp[] = $ks;
  14. $key_sp[$ks][] = $vs;
  15. // $key_sp[$ks]['img'] = $v['imgs'][0];
  16. }else{
  17. $key_sp[$ks][] = $vs;
  18. }

Call Stack

  1. in Goods.php line 364
  2. at Error::appError(2, 'Invalid argument sup...', '/www/wwwroot/spotspe...', 364, ['url' => 'youth-tsunami-gs-sui...', 'good' => ['goodsSpecs' => null], 'key_sp' => [], ...]) in Goods.php line 364
  3. at Goods->detail()
  4. at ReflectionMethod->invokeArgs(object(Goods), []) in Container.php line 395
  5. at Container->invokeReflectMethod(object(Goods), object(ReflectionMethod), ['id' => 'youth-tsunami-gs-sui...', 'convert' => false]) in Module.php line 132
  6. at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null)
  7. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  8. at Middleware->think\{closure}(object(Request))
  9. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  10. at Middleware->dispatch(object(Request), 'controller') in Module.php line 137
  11. at Module->exec() in Dispatch.php line 168
  12. at Dispatch->run() in App.php line 432
  13. at App->think\{closure}(object(Request), object(Closure), null)
  14. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  15. at Middleware->think\{closure}(object(Request))
  16. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  17. at Middleware->dispatch(object(Request)) in App.php line 435
  18. at App->run() in index.php line 21

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
HTTP_HOST www.spotspeed.com
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
PATH_INFO
REDIRECT_STATUS 200
SERVER_NAME spotspeed.com
SERVER_PORT 80
SERVER_ADDR 172.31.47.202
REMOTE_PORT 39578
REMOTE_ADDR 3.237.46.120
SERVER_SOFTWARE nginx/1.18.0
GATEWAY_INTERFACE CGI/1.1
REQUEST_SCHEME http
SERVER_PROTOCOL HTTP/1.1
DOCUMENT_ROOT /www/wwwroot/spotspeed.com/public
DOCUMENT_URI /index.php
REQUEST_URI /product/youth-tsunami-gs-suit
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=/product/youth-tsunami-gs-suit
SCRIPT_FILENAME /www/wwwroot/spotspeed.com/public/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711659631.9335
REQUEST_TIME 1711659631
Environment Variablesempty
ThinkPHP Constants
PHP_OS_FAMILY Linux