[8] ErrorException in Index.php line 165

未定义数组索引: clicks

  1. //新闻详情
  2. public function newsDetail(){
  3. $id = intval($this->request->param('id'));
  4. $new_d = Db::name('news')->where('id',$id)->find();
  5. if(empty($new_d['desc'])){
  6. $new_d['content'] = str_replace("合肥",$this->city,$new_d['content']);
  7. }else{
  8. $new_d['desc'] = str_replace("合肥",$this->city,$new_d['desc']);
  9. }
  10. $new_d['clicks'] = $new_d['clicks']+1;
  11. Db::name('news')->where('id',$id)->update(['clicks'=>$new_d['clicks']]);
  12. //上一篇
  13. $new_af = Db::name('news')->field('id,title')->where('is_ok',1)->where('id','<',$id)->order('id desc')->limit(1)->find();
  14. //下一篇
  15. $new_be = Db::name('news')->field('id,title')->where('is_ok',1)->where('id','>',$id)->order('id asc')->limit(1)->find();
  16. $this->assign('new_d',$new_d);
  17. $this->assign('new_be',$new_be);
  18. $this->assign('new_af',$new_af);

Call Stack

  1. in Index.php line 165
  2. at Error::appError(8, 'Undefined index: cli...', '/www/wwwroot/default...', 165, ['id' => 0, 'new_d' => ['content' => '']]) in Index.php line 165
  3. at Index->newsDetail()
  4. at ReflectionMethod->invokeArgs(object(Index), []) in Container.php line 373
  5. at Container->invokeReflectMethod(object(Index), object(ReflectionMethod), ['id' => 'solution']) in Module.php line 130
  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 188
  8. at Middleware->think\{closure}(object(Request))
  9. at call_user_func(object(Closure), object(Request)) in Middleware.php line 133
  10. at Middleware->dispatch(object(Request), 'controller') in Module.php line 135
  11. at Module->exec() in Dispatch.php line 167
  12. at Dispatch->run() in App.php line 435
  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 188
  15. at Middleware->think\{closure}(object(Request))
  16. at call_user_func(object(Closure), object(Request)) in Middleware.php line 133
  17. at Middleware->dispatch(object(Request)) in App.php line 438
  18. at App->run() in index.php line 21

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
SCRIPT_NAME /index.php
REQUEST_URI /newsDetail/id/solution.html
QUERY_STRING s=/newsDetail/id/solution.html
REQUEST_METHOD GET
SERVER_PROTOCOL HTTP/1.1
GATEWAY_INTERFACE CGI/1.1
REDIRECT_QUERY_STRING s=/newsDetail/id/solution.html
REDIRECT_URL /newsDetail/id/solution.html
REMOTE_PORT 45244
SCRIPT_FILENAME /www/wwwroot/default/www_liumaisoft_cn/public/index.php
SERVER_ADMIN webmaster@example.com
CONTEXT_DOCUMENT_ROOT /www/wwwroot/default/www_liumaisoft_cn/public
CONTEXT_PREFIX
REQUEST_SCHEME http
DOCUMENT_ROOT /www/wwwroot/default/www_liumaisoft_cn/public
REMOTE_ADDR 54.81.185.66
SERVER_PORT 80
SERVER_ADDR 172.24.70.49
SERVER_NAME www.liumaisoft.cn
SERVER_SOFTWARE Apache
SERVER_SIGNATURE <address>Apache Server at www.liumaisoft.cn Port 80</address>
LD_LIBRARY_PATH /www/server/apache/lib
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
HTTP_HOST www.liumaisoft.cn
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
proxy-nokeepalive 1
REDIRECT_STATUS 200
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1710845646.4029
REQUEST_TIME 1710845646
Environment Variablesempty
ThinkPHP Constantsempty