[0] ThrowableError in News.php line 63

致命错误: Call to a member function newsImg() on null

  1. $this->assign('local', $local);
  2. return $this->fetch('index');
  3. }
  4. public function detail(){
  5. $id = Request::param('id');
  6. $news = new model\News();
  7. $cateSql = new model\NewsCate();
  8. $list = $news ->where(['trash'=> 1,'is_show'=>1,'id'=>$id]) ->order(['sort','id desc'])-> find();
  9. $img = $list -> newsImg() -> find();
  10. $cate = $list -> newsCate() -> find();
  11. $seo = $list -> newsSeo() -> find();
  12. $list['cate'] = $cate['cate_name'];
  13. $list['img'] = $img['img'];
  14. $list['alt'] = $img['alt'];
  15. $list['title'] = $seo['title'];
  16. $list['keywords'] = $seo['keywords'];
  17. $list['description'] = $seo['description'];
  18. $list['tag'] = $seo['tag'];

Call Stack

  1. in News.php line 63
  2. at News->detail()
  3. at ReflectionMethod->invokeArgs(object(News), []) in Container.php line 395
  4. at Container->invokeReflectMethod(object(News), object(ReflectionMethod), ['id' => '16', 'convert' => false]) in Module.php line 135
  5. at Module->think\route\dispatch\{closure}(object(Request), object(Closure), null)
  6. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  7. at Middleware->think\{closure}(object(Request))
  8. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  9. at Middleware->dispatch(object(Request), 'controller') in Module.php line 140
  10. at Module->exec() in Dispatch.php line 168
  11. at Dispatch->run() in App.php line 432
  12. at App->think\{closure}(object(Request), object(Closure), null)
  13. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 185
  14. at Middleware->think\{closure}(object(Request))
  15. at call_user_func(object(Closure), object(Request)) in Middleware.php line 130
  16. at Middleware->dispatch(object(Request)) in App.php line 435
  17. at App->run() in index.php line 21

Environment Variables

GET Dataempty
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
REDIRECT_REDIRECT_UNIQUE_ID ZgW4nw9P1UHzB@xs@wJyCgAAAAk
REDIRECT_REDIRECT_PHPRC /home/kqtttk7q5tmt/others
REDIRECT_REDIRECT_STATUS 200
REDIRECT_UNIQUE_ID ZgW4nw9P1UHzB@xs@wJyCgAAAAk
REDIRECT_PHPRC /home/kqtttk7q5tmt/others
REDIRECT_HANDLER php-cgi
REDIRECT_STATUS 200
UNIQUE_ID ZgW4nw9P1UHzB@xs@wJyCgAAAAk
PHPRC /home/kqtttk7q5tmt/others
HTTP_X_FORWARDED_FOR 34.229.50.161
HTTP_X_REAL_IP 116.255.186.75
HTTP_HOST anallerg.com
HTTP_CONNECTION close
HTTP_ACCEPT_ENCODING gzip
HTTP_X_FORWARDED_PROTO http
HTTP_ACCEPT */*
HTTP_USER_AGENT claudebot
PATH /sbin:/usr/sbin:/bin:/usr/bin
SERVER_SIGNATURE <address>Apache Server at anallerg.com Port 80</address>
SERVER_SOFTWARE Apache
SERVER_NAME anallerg.com
SERVER_ADDR 127.0.0.1
SERVER_PORT 80
REMOTE_ADDR 34.229.50.161
DOCUMENT_ROOT /home/kqtttk7q5tmt/wwwroot
REQUEST_SCHEME http
CONTEXT_PREFIX /php-run-as-cgi
CONTEXT_DOCUMENT_ROOT /usr/php7.2/bin
SERVER_ADMIN webmaster@kqtt
SCRIPT_FILENAME /home/kqtttk7q5tmt/wwwroot/index.php
REMOTE_PORT 37726
REDIRECT_URL /index.php
REDIRECT_QUERY_STRING s=news_detail/16.html
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.0
REQUEST_METHOD GET
QUERY_STRING s=news_detail/16.html
REQUEST_URI /news_detail/16.html
SCRIPT_NAME /index.php
ORIG_SCRIPT_FILENAME /usr/php7.2/bin/php-cgi
ORIG_PATH_INFO /index.php
ORIG_PATH_TRANSLATED /home/kqtttk7q5tmt/wwwroot/index.php
ORIG_SCRIPT_NAME /php-run-as-cgi/php-cgi
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711650975.254
REQUEST_TIME 1711650975
Environment Variablesempty
ThinkPHP Constantsempty