[0] ThrowableError in Contents.php line 56

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

  1. */
  2. public function getlist($page, $size, $where = "", $order = 'id desc') {
  3. return $this->where($where)->order($order)->page($page, $size)->select()->toArray();
  4. }
  5. /**
  6. * 获取分类详情
  7. */
  8. public function getById($id) {
  9. return (Object) $this->where('id', $id)->find()->toArray();
  10. }
  11. /**
  12. * 获取josn用到的列表
  13. * $type 1查询分页 2查询总数
  14. */
  15. public function getListAll($type) {
  16. $page = input('get.page');

Call Stack

  1. in Contents.php line 56
  2. at Contents->getById('6') in News.php line 20
  3. at News->detail()
  4. at ReflectionMethod->invokeArgs(object(News), []) in Container.php line 285
  5. at Container->invokeReflectMethod(object(News), object(ReflectionMethod), ['id' => '6']) in Module.php line 133
  6. at Module->run() in App.php line 377
  7. at App->think\{closure}(object(Request), object(Closure), null)
  8. at call_user_func_array(object(Closure), [object(Request), object(Closure), null]) in Middleware.php line 105
  9. at Middleware->think\{closure}(object(Request))
  10. at call_user_func(object(Closure), object(Request)) in Middleware.php line 66
  11. at Middleware->dispatch(object(Request)) in App.php line 398
  12. at App->run() in index.php line 18

Environment Variables

GET Data
id 6
POST Dataempty
Filesempty
Cookiesempty
Sessionempty
Server/Request Data
USER www
HOME /home/www
HTTP_HOST www.xinsheng100.com
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
PATH_INFO //newsDetail.html
REDIRECT_STATUS 200
SERVER_NAME www.xinsheng100.com
SERVER_PORT 80
SERVER_ADDR 172.24.234.238
REMOTE_PORT 36658
REMOTE_ADDR 54.196.106.106
SERVER_SOFTWARE nginx/1.18.0
GATEWAY_INTERFACE CGI/1.1
REQUEST_SCHEME http
SERVER_PROTOCOL HTTP/1.1
DOCUMENT_ROOT /mnt/wwwroot/www.xinsheng100.com
DOCUMENT_URI /index.php
REQUEST_URI /newsDetail.html?id=6
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING s=//newsDetail.html&id=6
SCRIPT_FILENAME /mnt/wwwroot/www.xinsheng100.com/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711712249.4462
REQUEST_TIME 1711712249
Environment Variablesempty
ThinkPHP Constants
APP_PATH /mnt/wwwroot/www.xinsheng100.com/application/
ADMIN_TPL /application/admin/view
INDEX_TPL /application/index/view
default_module index