[8] ErrorException in News.php line 43

未定义数组下标: 0

  1. /**
  2. * [newsdetail description]新闻中心详情页
  3. * @return array $location 所属栏目信息
  4. */
  5. public function newsdetail()
  6. {
  7. $id = input('get.id');
  8. $select = Db::name('article')->where("id=$id")->select();
  9. $onclick = $select[0]['onclick'] + 1;
  10. // 当前文章的浏览量加1
  11. $result = Db::name('article')->where("id=$id")->update(['onclick' => $onclick]);
  12. if ($result) {
  13. $newsDetail = Db::name('article')->where("id=$id")->select();
  14. }
  15. $this->assign('newsDetail',$newsDetail);
  16. // 所在位置子栏目查询
  17. foreach ($newsDetail as $value) {
  18. $id = $value['classid'];

Call Stack

  1. in News.php line 43
  2. at Error::appError(8, 'Undefined offset: 0', '/alidata/www/stock/a...', 43, ['id' => '992', 'select' => []]) in News.php line 43
  3. at News->newsdetail()
  4. at ReflectionMethod->invokeArgs(object(News), []) in App.php line 234
  5. at App::invokeMethod([object(News), 'newsdetail'], []) in App.php line 401
  6. at App::module(['index', 'news', 'newsdetail'], ['app_namespace' => 'app', 'app_debug' => true, 'app_trace' => false, ...], true) in App.php line 140
  7. at App::run() in start.php line 18
  8. at require('/alidata/www/stock/t...') in index.php line 24

Exception Datas

Error Context
id 992
select []

Environment Variables

GET Data
classid 6
id 992
POST Dataempty
Filesempty
Cookies
PHPSESSID k497u3rs7ol1lp5kc7139dk322
Sessionempty
Server/Request Data
REDIRECT_STATUS 200
HTTP_USER_AGENT CCBot/2.0 (https://commoncrawl.org/faq/)
HTTP_HOST www.zyddcm.com
HTTP_ACCEPT */*
HTTP_ACCEPT_ENCODING gzip
HTTP_COOKIE PHPSESSID=k497u3rs7ol1lp5kc7139dk322
PATH /sbin:/usr/sbin:/bin:/usr/bin
LD_LIBRARY_PATH /alidata/server/httpd/lib
SERVER_SIGNATURE
SERVER_SOFTWARE Apache/2.4.2 (Unix) PHP/7.4.28
SERVER_NAME www.zyddcm.com
SERVER_ADDR 10.100.10.9
SERVER_PORT 80
REMOTE_ADDR 104.206.1.218
DOCUMENT_ROOT /alidata/www/stock
REQUEST_SCHEME http
CONTEXT_PREFIX
CONTEXT_DOCUMENT_ROOT /alidata/www/stock
SERVER_ADMIN you@example.com
SCRIPT_FILENAME /alidata/www/stock/index.php
REMOTE_PORT 52080
REDIRECT_QUERY_STRING s=index/news/newsdetail&classid=6&id=992
REDIRECT_URL /index/news/newsdetail
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD GET
QUERY_STRING s=index/news/newsdetail&classid=6&id=992
REQUEST_URI //index/news/newsdetail?classid=6&id=992
SCRIPT_NAME /index.php
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1660696265.7361
REQUEST_TIME 1660696265
argv [ "s=index\/news\/newsdetail&classid=6&id=992" ]
argc 1
PATH_INFO index/news/newsdetail
Environment Variables
TERM xterm
SYSTEMCTL_SKIP_REDIRECT
LD_LIBRARY_PATH /alidata/server/httpd/lib
PATH /sbin:/usr/sbin:/bin:/usr/bin
PWD /
SHLVL 1
SYSTEMCTL_IGNORE_DEPENDENCIES
_ /alidata/server/httpd/bin/httpd
ThinkPHP Constants
APP_PATH /alidata/www/stock/application/
APP_DEBUG true
THINK_VERSION 5.0.4
THINK_START_TIME 1660696265.737
THINK_START_MEM 400400
EXT .php
DS /
THINK_PATH /alidata/www/stock/thinkphp/
LIB_PATH /alidata/www/stock/thinkphp/library/
CORE_PATH /alidata/www/stock/thinkphp/library/think/
TRAIT_PATH /alidata/www/stock/thinkphp/library/traits/
ROOT_PATH /alidata/www/stock/
EXTEND_PATH /alidata/www/stock/extend/
VENDOR_PATH /alidata/www/stock/vendor/
RUNTIME_PATH /alidata/www/stock/runtime/
LOG_PATH /alidata/www/stock/runtime/log/
CACHE_PATH /alidata/www/stock/runtime/cache/
TEMP_PATH /alidata/www/stock/runtime/temp/
CONF_PATH /alidata/www/stock/application/
CONF_EXT .php
ENV_PREFIX PHP_
IS_CLI false
IS_WIN false