[2] ErrorException in GoodsService.php line 470

Invalid argument supplied for foreach()

  1. // 规格类型
  2. $choose = Db::name('GoodsSpecType')->where($where)->order('id asc')->select();
  3. if(!empty($choose))
  4. {
  5. // 数据处理
  6. foreach($choose as &$temp_type)
  7. {
  8. $temp_type_value = json_decode($temp_type['value'], true);
  9. foreach($temp_type_value as &$vs)
  10. {
  11. $vs['images'] = ResourcesService::AttachmentPathViewHandle($vs['images']);
  12. }
  13. $temp_type['value'] = $temp_type_value;
  14. $temp_type['add_time'] = date('Y-m-d H:i:s');
  15. }
  16. // 只有一个规格的时候直接获取规格值的库存数
  17. if(count($choose) == 1)

Call Stack

  1. in GoodsService.php line 470
  2. at Error::appError(2, 'Invalid argument sup...', '/data/wwwroot/tingsh...', 470, ['params' => ['goods_id' => '551'], 'where' => ['goods_id' => '551'], 'choose' => [['id' => '596', 'goods_id' => '551', 'value' => '...', ...]], ...]) in GoodsService.php line 470
  3. at GoodsService::GoodsSpecifications(['goods_id' => '551']) in GoodsService.php line 391
  4. at GoodsService::GoodsDataHandle(['where' => ['id' => '551', 'is_delete_time' => 0], 'is_photo' => true, 'is_spec' => true], [['id' => '551', 'brand_id' => '0', 'title' => '欧普照明(OPPLE...', ...]]) in GoodsService.php line 911
  5. at GoodsService::GoodsList(['where' => ['id' => '551', 'is_delete_time' => 0], 'is_photo' => true, 'is_spec' => true]) in Goods.php line 58
  6. at Goods->Index()
  7. at ReflectionMethod->invokeArgs(object(Goods), []) in Container.php line 395
  8. at Container->invokeReflectMethod(object(Goods), object(ReflectionMethod), ['id' => '551']) in Module.php line 132
  9. at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null)
  10. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  11. at Middleware->think\{closure}(object(Request))
  12. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  13. at Middleware->dispatch(object(Request), 'controller') in Module.php line 137
  14. at Module->exec() in Dispatch.php line 168
  15. at Dispatch->run() in App.php line 432
  16. at App->think\{closure}(object(Request), object(Closure), null)
  17. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  18. at Middleware->think\{closure}(object(Request)) in SystemEnvCheck.php line 42
  19. at SystemEnvCheck->handle(object(Request), object(Closure), null)
  20. at call_user_func_array([object(SystemEnvCheck), 'handle'], [object(Request), object(Closure), null]) in Middleware.php line 185
  21. at Middleware->think\{closure}(object(Request))
  22. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  23. at Middleware->dispatch(object(Request)) in App.php line 435
  24. at App->run() in index.php line 23

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER
www
HOME
/home/www
HTTP_ACCEPT_ENCODING
deflate, gzip
HTTP_ACCEPT
*/*
HTTP_HOST
www.tingshuxing.com
HTTP_USER_AGENT
Mozilla/5.0+(compatible;+Baiduspider/2.0;++http://www.baidu.com/search/spider.html)
PATH_INFO
REDIRECT_STATUS
200
SERVER_NAME
tingshuxing.com
SERVER_PORT
80
SERVER_ADDR
172.31.50.176
REMOTE_PORT
20000
REMOTE_ADDR
154.92.157.172
SERVER_SOFTWARE
nginx/1.15.10
GATEWAY_INTERFACE
CGI/1.1
REQUEST_SCHEME
http
SERVER_PROTOCOL
HTTP/1.1
DOCUMENT_ROOT
/data/wwwroot/tingshuxing.com/public
DOCUMENT_URI
/index.php
REQUEST_URI
/index.php?s=/index/goods/index/id/551.html
SCRIPT_NAME
/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD
GET
QUERY_STRING
s=/index/goods/index/id/551.html
SCRIPT_FILENAME
/data/wwwroot/tingshuxing.com/public/index.php
FCGI_ROLE
RESPONDER
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1601286703.1963
REQUEST_TIME
1601286703
Environment Variablesempty
ThinkPHP Constants
APPLICATION_VERSION
v1.5.0
DS
/
__MY_HTTP__
http
__MY_ROOT__
__MY_ROOT_PUBLIC__
/
__MY_HOST__
www.tingshuxing.com
__MY_URL__
http://www.tingshuxing.com/
__MY_PUBLIC_URL__
http://www.tingshuxing.com/
__MY_VIEW_URL__
http://www.tingshuxing.com/index.php?s=/index/goods/index/id/551.html
ROOT_PATH
/data/wwwroot/tingshuxing.com/public/
ROOT
/data/wwwroot/tingshuxing.com/
APP_PATH
/data/wwwroot/tingshuxing.com/application/
APPLICATION
web
APPLICATION_CLIENT_TYPE
pc
IS_AJAX
false