[8] ErrorException in Cate.php line 48

未定义数组索引:

  1. // 1 => 0,
  2. // // 省略...
  3. // 5 => 1,
  4. // // 省略...
  5. // 13 => 5
  6. // ];
  7. // 建议将这数组缓存起来
  8. $id = $cid;
  9. while($arr[$id]) {
  10. $id = $arr[$id];
  11. }
  12. return $id; // 1
  13. }
  14. //获取所有同级栏目
  15. public function getPeerCate($id)
  16. {
  17. $arr = [];
  18. $idRes = db('cate') -> field('id,pid') -> find($id);

Call Stack

  1. in Cate.php line 48
  2. at Error::appError(8, 'Undefined index: ', '/www/wwwroot/shengma...', 48, ['cid' => null, 'data' => [['id' => 15, 'pid' => 0], ['id' => 1, 'pid' => 0], ['id' => 7, 'pid' => 3], ...], 'arr' => [0, 0, 3, ...], ...]) in Cate.php line 48
  3. at Cate->getTopId(null) in Article.php line 43
  4. at Article->index('Product', 'duomeitishouhuoji')
  5. at ReflectionMethod->invokeArgs(object(Article), ['Product', 'duomeitishouhuoji']) in App.php line 343
  6. at App::invokeMethod([object(Article), 'index'], []) in App.php line 611
  7. at App::module(['index', 'Article', 'index'], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], false) in App.php line 457
  8. at App::exec(['type' => 'module', 'module' => ['index', 'Article', 'index'], 'convert' => false], ['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/shengma...') in index.php line 18

Environment Variables

GET Data
empty
POST Data
empty
Files
empty
Cookies
empty
Session
empty

Server/Request Data

USER
www
HOME
/home/www
FCGI_ROLE
RESPONDER
SCRIPT_FILENAME
/www/wwwroot/shengmakeji.com/public/index.php
QUERY_STRING
s=/Product/duomeitishouhuoji/
REQUEST_METHOD
GET
CONTENT_TYPE
CONTENT_LENGTH
SCRIPT_NAME
/index.php
REQUEST_URI
/Product/duomeitishouhuoji/
DOCUMENT_URI
/index.php
DOCUMENT_ROOT
/www/wwwroot/shengmakeji.com/public
SERVER_PROTOCOL
HTTP/1.1
REQUEST_SCHEME
http
GATEWAY_INTERFACE
CGI/1.1
SERVER_SOFTWARE
nginx/1.22.1
REMOTE_ADDR
44.203.235.24
REMOTE_PORT
42456
SERVER_ADDR
10.0.8.8
SERVER_PORT
80
SERVER_NAME
shengmakeji.com
REDIRECT_STATUS
200
PATH_INFO
/Product/duomeitishouhuoji/
HTTP_ACCEPT
*/*
HTTP_USER_AGENT
claudebot
HTTP_HOST
www.shengmakeji.com
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1711668217.0453
REQUEST_TIME
1711668217
Environment Variables
empty

ThinkPHP Constants

APP_PATH
/www/wwwroot/shengmakeji.com/public/../application/
APP_DEBUG
false
THINK_VERSION
5.0.24
THINK_START_TIME
1711668217.0458
THINK_START_MEM
259696
EXT
.php
DS
/
THINK_PATH
/www/wwwroot/shengmakeji.com/thinkphp/
LIB_PATH
/www/wwwroot/shengmakeji.com/thinkphp/library/
CORE_PATH
/www/wwwroot/shengmakeji.com/thinkphp/library/think/
TRAIT_PATH
/www/wwwroot/shengmakeji.com/thinkphp/library/traits/
ROOT_PATH
/www/wwwroot/shengmakeji.com/
EXTEND_PATH
/www/wwwroot/shengmakeji.com/extend/
VENDOR_PATH
/www/wwwroot/shengmakeji.com/vendor/
RUNTIME_PATH
/www/wwwroot/shengmakeji.com/runtime/
LOG_PATH
/www/wwwroot/shengmakeji.com/runtime/log/
CACHE_PATH
/www/wwwroot/shengmakeji.com/runtime/cache/
TEMP_PATH
/www/wwwroot/shengmakeji.com/runtime/temp/
CONF_PATH
/www/wwwroot/shengmakeji.com/public/../application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false
VIEW_PATH
/www/wwwroot/shengmakeji.com/application/../template/pc/