调用模型方法获取不到?

浏览:819 发布日期:2019/01/07 分类:求助交流
<?php

namespace app\syadmin\model;

use think\Model;

class Manager extends Model

{
    //数据集转换,5.123以下版本才需要配置
    protected $resultSetType = 'collection';
    //时间戳不自动转换
    protected $autoWriteTimestamp = true;
    //显示列表
    protected static function getlist(){
        //parent::getlist();


       $result=self::all()->toArray();

        return $result;


}
<?php

namespace app\syadmin\controller;

use app\syadmin\model\Manager as ManagerMod;
use think\Request;




class Manager extends Common
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
public function index()
    {

        $result=ManagerMod::getlist();
        //dump($result);die;


        $this->assign('list', $result);
        return $this->fetch();
    }
提示错误:[0] Exception in F:\wwwroot\sy\thinkphp\library\think\db\Query.php line 103
method not exist:think\db\Query->getlist
            return $this->where($where)->value($args[1]);
        } elseif ($this->model && method_exists($this->model, 'scope' . $method)) {
            // 动态调用命名范围
            $method = 'scope' . $method;
            array_unshift($args, $this);

            call_user_func_array([$this->model, $method], $args);
            return $this;
        } else {
            throw new Exception('method not exist:' . __CLASS__ . '->' . $method);
        }
    }

    /**
     * 获取当前的数据库Connection对象
     * @access public
     * @return Connection
     */
    public function getConnection()
为什么获取不到模型内的方法!
最佳答案
评论( 相关
后面还有条评论,点击查看>>