[8] ErrorException in News.php line 45

未定义数组索引: type

  1. return $this->fetch();
  2. }
  3. public function detail()
  4. {
  5. $id = $this->request->param('id');
  6. $detail = Db::name('admin_news')->find($id);
  7. $detail['addtime'] = date('Y.m.d',$detail['create_time']);
  8. $this->assign('detail',$detail);
  9. $newsList = Db::name('admin_news')->where('type',$detail['type'])->order('create_time desc')->limit(4)->select();
  10. foreach($newsList as $k=>$row){
  11. $newsList[$k]['image'] = getHomeImg($row['img']);
  12. $newsList[$k]['addtime'] = date('Y-m-d',$row['create_time']);
  13. $newsList[$k]['content'] = mb_substr(strip_tags($row['content']),0,20).'......';
  14. $newsList[$k]['title'] = mb_substr(strip_tags($row['title']),0,15).'......';
  15. }
  16. $this->assign('newsList',$newsList);
  17. return $this->fetch();
  18. }

Call Stack

  1. in News.php line 45
  2. at Error::appError(8, 'Undefined index: typ...', '/www/wwwroot/zgfzyx....', 45, ['id' => '3', 'detail' => ['addtime' => '1970.01.01']]) in News.php line 45
  3. at News->detail()
  4. at ReflectionMethod->invokeArgs(object(News), []) in Container.php line 395
  5. at Container->invokeReflectMethod(object(News), object(ReflectionMethod), ['id' => '3']) in Module.php line 131
  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 185
  8. at Middleware->think\{closure}(object(Request))
  9. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  10. at Middleware->dispatch(object(Request), 'controller') in Module.php line 136
  11. at Module->exec() in Dispatch.php line 168
  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 185
  15. at Middleware->think\{closure}(object(Request))
  16. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  17. at Middleware->dispatch(object(Request)) in App.php line 435
  18. at App->run() in index.php line 33

Environment Variables

GET Data
id 3
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
HTTP_HOST zgfzyx.com
PATH_INFO /index/news/detail
REDIRECT_STATUS 200
SERVER_NAME zgfzyx.com
SERVER_PORT 443
SERVER_ADDR 192.168.0.98
REMOTE_PORT 60200
REMOTE_ADDR 54.205.238.173
SERVER_SOFTWARE nginx/1.22.0
GATEWAY_INTERFACE CGI/1.1
HTTPS on
REQUEST_SCHEME https
SERVER_PROTOCOL HTTP/2.0
DOCUMENT_ROOT /www/wwwroot/zgfzyx.com/public
DOCUMENT_URI /index.php/index/news/detail
REQUEST_URI /index/news/detail?id=3
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING id=3
SCRIPT_FILENAME /www/wwwroot/zgfzyx.com/public/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php/index/news/detail
REQUEST_TIME_FLOAT 1711642210.038
REQUEST_TIME 1711642210
Environment Variablesempty
ThinkPHP Constants
ADMIN_FILE admin.php
HTMLPURIFIER_PREFIX /www/wwwroot/zgfzyx.com/vendor/ezyang/htmlpurifier/library
PUBLIC_PATH /