[0] ThrowableError in EncyclModel.php line 30

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

  1. return $this->hasMany('EncyclPostModel','encycl_id')->where('status',$status)->field($filed)->order("post_order");
  2. }
  3. /**
  4. * 根据ID获取主知识及子段落
  5. * @param $id
  6. * @param string $filed
  7. */
  8. public function getArticleAndPost($id,$filed="*" ){
  9. $list=$this->where(['id'=>$id,'status'=>1])->field($filed)->find()->toArray();
  10. if(!empty($list)){
  11. if($list['type']==1){
  12. $listpost=$this->encyclPost()->where(['encycl_id'=>$id])->select()->toArray();
  13. $list["posts"]=$listpost;
  14. }
  15. }
  16. return $list;
  17. }

Call Stack

  1. in EncyclModel.php line 30
  2. at EncyclModel->getArticleAndPost('102') in IndexController.php line 136
  3. at IndexController->detail('102')
  4. at ReflectionMethod->invokeArgs(object(IndexController), ['102']) in App.php line 197
  5. at App::invokeMethod([object(IndexController), 'detail'], []) in App.php line 414
  6. at App::module(['encycl', 'index', 'detail'], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...], true) in App.php line 296
  7. at App::exec(['type' => 'module', 'module' => ['encycl', 'index', 'detail']], ['app_host' => '', 'app_debug' => true, 'app_trace' => false, ...]) in App.php line 124
  8. at App::run() in index.php line 41

Environment Variables

GET Data
empty
POST Data
empty
Files
empty
Cookies
empty
Session
empty

Server/Request Data

USER
www
HOME
/home/www
HTTP_HOST
www.norklighting.com
HTTP_USER_AGENT
claudebot
HTTP_ACCEPT
*/*
PATH_INFO
/encycl-index-detail-id-102.html
REDIRECT_STATUS
200
SERVER_NAME
www.norklighting.com
SERVER_PORT
80
SERVER_ADDR
101.37.205.21
REMOTE_PORT
34356
REMOTE_ADDR
34.230.66.177
SERVER_SOFTWARE
nginx/1.14.1
GATEWAY_INTERFACE
CGI/1.1
REQUEST_SCHEME
http
SERVER_PROTOCOL
HTTP/1.1
DOCUMENT_ROOT
/www/wwwroot/www_norklighting_com/public
DOCUMENT_URI
/index.php
REQUEST_URI
/encycl-index-detail-id-102.html
SCRIPT_NAME
/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD
GET
QUERY_STRING
s=/encycl-index-detail-id-102.html
SCRIPT_FILENAME
/www/wwwroot/www_norklighting_com/public/index.php
FCGI_ROLE
RESPONDER
PHP_SELF
/index.php
REQUEST_TIME_FLOAT
1710848710.1946
REQUEST_TIME
1710848710
Environment Variables
empty

ThinkPHP Constants

APP_DEBUG
true
CMF_ROOT
/www/wwwroot/www_norklighting_com/public/../
APP_PATH
/www/wwwroot/www_norklighting_com/public/../app/
CMF_PATH
/www/wwwroot/www_norklighting_com/public/../simplewind/cmf/
PLUGINS_PATH
/www/wwwroot/www_norklighting_com/public/plugins/
EXTEND_PATH
/www/wwwroot/www_norklighting_com/public/../simplewind/extend/
VENDOR_PATH
/www/wwwroot/www_norklighting_com/public/../simplewind/vendor/
RUNTIME_PATH
/www/wwwroot/www_norklighting_com/public/../data/runtime/
THINKCMF_VERSION
5.0.170927
THINK_VERSION
5.0.11
THINK_START_TIME
1710848710.1949
THINK_START_MEM
405304
EXT
.php
DS
/
THINK_PATH
/www/wwwroot/www_norklighting_com/simplewind/thinkphp/
LIB_PATH
/www/wwwroot/www_norklighting_com/simplewind/thinkphp/library/
CORE_PATH
/www/wwwroot/www_norklighting_com/simplewind/thinkphp/library/think/
TRAIT_PATH
/www/wwwroot/www_norklighting_com/simplewind/thinkphp/library/traits/
ROOT_PATH
/www/wwwroot/www_norklighting_com/
LOG_PATH
/www/wwwroot/www_norklighting_com/public/../data/runtime/log/
CACHE_PATH
/www/wwwroot/www_norklighting_com/public/../data/runtime/cache/
TEMP_PATH
/www/wwwroot/www_norklighting_com/public/../data/runtime/temp/
CONF_PATH
/www/wwwroot/www_norklighting_com/public/../app/
CONF_EXT
.php
ENV_PREFIX
PHP_
IS_CLI
false
IS_WIN
false
HTMLPURIFIER_PREFIX
/www/wwwroot/www_norklighting_com/simplewind/vendor/ezyang/htmlpurifier/library
QINIU_FUNCTIONS_VERSION
7.2.1