[2] ErrorException in Goods.php line 11

array_column() expects parameter 1 to be array, null given

  1. namespace app\index\controller;
  2. class Goods extends Common
  3. {
  4. public function detail() {
  5. $detail = $this->Rest('goods/detail', $this->input);
  6. $attrSkuId = [];
  7. if ($detail['skus']) {
  8. foreach ($detail['skus'] as $sku) {
  9. $valId = array_column($sku['attrs'], 'attrvalueid');
  10. sort($valId,SORT_NUMERIC);
  11. $attrSkuId[implode('-', $valId)] = $sku['id'];
  12. }
  13. }
  14. $this->assign('attrSkuId',$attrSkuId);
  15. $this->assign('detail',$detail);
  16. $this->setTitle('为人医械商城-'.$detail['info']['title']);

Call Stack

  1. in Goods.php line 11
  2. at Error::appError(2, 'array_column() expec...', '/www/wwwroot/weiren....', 11, ['detail' => ['info' => ['id' => 1295, 'type' => 4, 'goodsno' => '', ...], 'skus' => [['id' => 6532, 'goodsid' => 0, 'title' => '', ...]], 'attrs' => [], ...], 'attrSkuId' => [], 'sku' => ['id' => 6532, 'goodsid' => 0, 'title' => '', ...]])
  3. at array_column(null, 'attrvalueid') in Goods.php line 11
  4. at Goods->detail()
  5. at ReflectionMethod->invokeArgs(object(Goods), []) in App.php line 343
  6. at App::invokeMethod([object(Goods), 'detail'], []) in App.php line 606
  7. at App::module(['index', 'goods', 'detail'], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], true) in App.php line 456
  8. at App::exec(['type' => 'module', 'module' => ['index', 'goods', 'detail']], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 139
  9. at App::run() in start.php line 19
  10. at require('/www/wwwroot/weiren....') in index.php line 27

Environment Variables

GET Data

id
1295
POST Data
empty
Files
empty
Cookies
empty

Session

kenny_
{ "wap": { "tempid": "id_hz1wqtms" } }

Server/Request Data

USER
www
HOME
/home/www
HTTP_HOST
www.weiren.com
HTTP_USER_AGENT
claudebot
HTTP_ACCEPT
*/*
PATH_INFO
//goods/detail.html
REDIRECT_STATUS
200
SERVER_NAME
www.weiren.com
SERVER_PORT
80
SERVER_ADDR
10.26.248.208
REMOTE_PORT
43224
REMOTE_ADDR
184.72.135.210
SERVER_SOFTWARE
nginx/1.20.2
GATEWAY_INTERFACE
CGI/1.1
REQUEST_SCHEME
http
SERVER_PROTOCOL
HTTP/1.1
DOCUMENT_ROOT
/www/wwwroot/weiren.com/public
DOCUMENT_URI
/index.php//goods/detail.html
REQUEST_URI
/goods/detail.html?id=1295
SCRIPT_NAME
/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD
GET
QUERY_STRING
id=1295
SCRIPT_FILENAME
/www/wwwroot/weiren.com/public/index.php
FCGI_ROLE
RESPONDER
PHP_SELF
/index.php//goods/detail.html
REQUEST_TIME_FLOAT
1711648725.6916
REQUEST_TIME
1711648725
Environment Variables
empty

ThinkPHP Constants

CONF_PATH
/www/wwwroot/weiren.com/public/../config/
BIND_MODULE
index
TEMP_PATH
/www/wwwroot/weiren.com/public/../runtime/index/temp/
LOG_PATH
/www/wwwroot/weiren.com/public/../runtime/index/log/
PROJECT_VERSION
V1.0.6
APP_PATH
/www/wwwroot/weiren.com/public/../application/
TEMPLATE_PATH
/www/wwwroot/weiren.com/public/../template/
THINK_VERSION
5.0.16
THINK_START_TIME
1711648725.692
THINK_START_MEM
404720
EXT
.php
DS
/
THINK_PATH
/www/wwwroot/weiren.com/thinkphp/
LIB_PATH
/www/wwwroot/weiren.com/thinkphp/library/
CORE_PATH
/www/wwwroot/weiren.com/thinkphp/library/think/
TRAIT_PATH
/www/wwwroot/weiren.com/thinkphp/library/traits/
ROOT_PATH
/www/wwwroot/weiren.com/
EXTEND_PATH
/www/wwwroot/weiren.com/extend/
VENDOR_PATH
/www/wwwroot/weiren.com/vendor/
RUNTIME_PATH
/www/wwwroot/weiren.com/runtime/
CACHE_PATH
/www/wwwroot/weiren.com/runtime/cache/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false
KENNY_EVN
product
SITE_ID
5