[8] ErrorException in News.php line 54

未定义数组下标: 0

  1. $id = input('id');
  2. $all = array();
  3. $alldata = array();
  4. $news = Db('news')->where('id',$id)->find();
  5. $data = Db('news')->field('id,title')->where(['cid'=>$news['cid'],'deletetime'=>null,'status'=>1])->order('weigh desc,createtime desc')->select();
  6. foreach ($data as $k => $v) {
  7. $all[$k] = $v['id'];
  8. $alldata[$k] = $v['title'];
  9. }
  10. $key = array_keys($all,$id)[0];
  11. $lenght = count($all)-1;
  12. $this->view->assign('news',$news);
  13. $this->view->assign('key',$key);
  14. $this->view->assign('all',$all);
  15. $this->view->assign('alldata',$alldata);
  16. $this->view->assign('lenght',$lenght);
  17. return $this->view->fetch();
  18. }

Call Stack

  1. in News.php line 54
  2. at Error::appError(8, 'Undefined offset: 0', '/www/wwwroot/hongcai...', 54, ['banner' => ['id' => 5, 'title' => '新闻中心', 'catid' => 1, ...], 'id' => '149', 'all' => [270, 265, 264, ...], ...]) in News.php line 54
  3. at News->xq()
  4. at ReflectionMethod->invokeArgs(object(News), []) in App.php line 343
  5. at App::invokeMethod([object(News), 'xq'], []) in App.php line 611
  6. at App::module(['index', 'news', 'xq'], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], true) in App.php line 456
  7. at App::exec(['type' => 'module', 'module' => ['index', 'news', 'xq']], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 139
  8. at App::run() in start.php line 19
  9. at require('/www/wwwroot/hongcai...') in index.php line 24

Environment Variables

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

Server/Request Data

USER
www
HOME
/home/www
HTTP_REFERER
http://jollylighting.com/index/news/xq/id/149.html
HTTP_USER_AGENT
claudebot
HTTP_ACCEPT
*/*
HTTP_HOST
jollylighting.com
PATH_INFO
/index/news/xq/id/149.html
REDIRECT_STATUS
200
SERVER_NAME
hc2.more.jollylighting.com
SERVER_PORT
443
SERVER_ADDR
172.18.125.224
REMOTE_PORT
38960
REMOTE_ADDR
3.239.162.98
SERVER_SOFTWARE
nginx/1.18.0
GATEWAY_INTERFACE
CGI/1.1
HTTPS
on
REQUEST_SCHEME
https
SERVER_PROTOCOL
HTTP/2.0
DOCUMENT_ROOT
/www/wwwroot/hongcai/public
DOCUMENT_URI
/index.php
REQUEST_URI
/index/news/xq/id/149.html
SCRIPT_NAME
/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD
GET
QUERY_STRING
s=/index/news/xq/id/149.html
SCRIPT_FILENAME
/www/wwwroot/hongcai/public/index.php
FCGI_ROLE
RESPONDER
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1711727420.7441
REQUEST_TIME
1711727420
Environment Variables
empty

ThinkPHP Constants

APP_PATH
/www/wwwroot/hongcai/public/../application/
THINK_VERSION
5.0.24
THINK_START_TIME
1711727420.7448
THINK_START_MEM
404816
EXT
.php
DS
/
THINK_PATH
/www/wwwroot/hongcai/thinkphp/
LIB_PATH
/www/wwwroot/hongcai/thinkphp/library/
CORE_PATH
/www/wwwroot/hongcai/thinkphp/library/think/
TRAIT_PATH
/www/wwwroot/hongcai/thinkphp/library/traits/
ROOT_PATH
/www/wwwroot/hongcai/
EXTEND_PATH
/www/wwwroot/hongcai/extend/
VENDOR_PATH
/www/wwwroot/hongcai/vendor/
RUNTIME_PATH
/www/wwwroot/hongcai/runtime/
LOG_PATH
/www/wwwroot/hongcai/runtime/log/
CACHE_PATH
/www/wwwroot/hongcai/runtime/cache/
TEMP_PATH
/www/wwwroot/hongcai/runtime/temp/
CONF_PATH
/www/wwwroot/hongcai/public/../application/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false
ADDON_PATH
/www/wwwroot/hongcai/addons/