[8] ErrorException in News.php line 42

未定义数组索引: n_hits

  1. }
  2. public function detail($newsid) {
  3. //判断传输方式GET OR POST
  4. $detail = db('news')->field('n_id,n_title,n_content,n_date,n_hits,n_account,n_class')->where(['n_id' => $newsid])->find();
  5. $detail['n_date'] = date('Y-m-d', strtotime($detail['n_date']));
  6. $this->assign('detail', $detail);
  7. //更新点击量
  8. $hits = db('news')->where(['n_id'=>$newsid])->update(['n_hits'=>$detail['n_hits']+1]);
  9. //上一条 下一条
  10. $next_news = db('news')->field('n_id,n_title,n_class')->where(['n_id' => ['<', $newsid], 'n_class' => $detail['n_class']])->find();
  11. if (!$next_news) {
  12. $next_news['n_id'] = 0;
  13. }
  14. $pre_news = db('news')->field('n_id,n_title,n_class')->where(['n_id' => ['>', $newsid], 'n_class' => $detail['n_class']])->find();
  15. if (!$pre_news) {
  16. $pre_news['n_id'] = 0;
  17. }

Call Stack

  1. in News.php line 42
  2. at Error::appError(8, 'Undefined index: n_h...', '/data/wwwroot/www.cn...', 42, ['newsid' => 'mailto', 'detail' => ['n_date' => '1970-01-01']]) in News.php line 42
  3. at News->detail('mailto')
  4. at ReflectionMethod->invokeArgs(object(News), ['mailto']) in Container.php line 372
  5. at Container->invokeReflectMethod(object(News), object(ReflectionMethod), ['newsid' => 'mailto']) in Module.php line 129
  6. at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null)
  7. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 176
  8. at Middleware->think\{closure}(object(Request))
  9. at call_user_func(object(Closure), object(Request)) in Middleware.php line 121
  10. at Middleware->dispatch(object(Request), 'controller') in Module.php line 134
  11. at Module->exec() in Dispatch.php line 167
  12. at Dispatch->run() in App.php line 432
  13. at App->think\{closure}(object(Request), object(Closure), null)
  14. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 176
  15. at Middleware->think\{closure}(object(Request))
  16. at call_user_func(object(Closure), object(Request)) in Middleware.php line 121
  17. at Middleware->dispatch(object(Request)) in App.php line 435
  18. at App->run() in index.php line 45

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_USER_AGENT
Mozilla/5.0+(compatible;+Baiduspider/2.0;++http://www.baidu.com/search/spider.html)
HTTP_CONNECTION
close
HTTP_HOST
211.149.194.103:8090
PATH_INFO
REDIRECT_STATUS
200
SERVER_NAME
www.cnotc.org
SERVER_PORT
8090
SERVER_ADDR
211.149.194.103
REMOTE_PORT
40971
REMOTE_ADDR
154.223.169.238
SERVER_SOFTWARE
nginx/1.14.2
GATEWAY_INTERFACE
CGI/1.1
REQUEST_SCHEME
http
SERVER_PROTOCOL
HTTP/1.0
DOCUMENT_ROOT
/data/wwwroot/www.cnotc.org/public
DOCUMENT_URI
/index.php
REQUEST_URI
/news/detail/mailto:dyzjs5058@vip.163.com
SCRIPT_NAME
/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD
GET
QUERY_STRING
s=/news/detail/mailto:dyzjs5058@vip.163.com
SCRIPT_FILENAME
/data/wwwroot/www.cnotc.org/public/index.php
FCGI_ROLE
RESPONDER
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1566670720.193
REQUEST_TIME
1566670720
Environment Variablesempty
ThinkPHP Constants
APP_DOWNLOAD_PATH
/data/wwwroot/www.cnotc.org/public/download
FONT_PATH
/data/wwwroot/www.cnotc.org/public/font/t1.ttf
COOKIE_PATH
/data/wwwroot/www.cnotc.org/public/cookies
STATIC_CACHE_TIME
201811140258896878.x.02015
WEB_WEB_URL
http://www.cnotc.org/
WEB_API_URL
http://www.cnotc.org/v1/
WEB_U_URL
http://www.cnotc.org/u/
WEB_SSO_URL
http://wxo2o.im0511.com/SSO/
WEB_ST_URL
http://www.cnotc.org/
COOKIE_DOMAIN
.cnotc.org
CACHE_TIME
60
WEB_IMG_URL
http://img.wxo2o.im0511.com/
GOOPLE_VERSION
v1.3 Release 20170125