首頁 >後端開發 >php教程 >thinkphp自定义业务逻辑有有关问题

thinkphp自定义业务逻辑有有关问题

WBOY
WBOY原創
2016-06-13 10:05:27895瀏覽

thinkphp自定义业务逻辑有问题?
模型:

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->class DepartmentModel extends Model{        public function getIndexDepart()    {        return 1;     }      


控制器
PHP code
 <br> class IndexAction extends Action <br> { <br>     public function index() <br>     { <br> 		$a = D('Department'); <br> 		echo " <pre class="brush:php;toolbar:false">"; <br> 		print_r($a->getIndexDepart()); <br> 		echo " 
";
        //echo THINK_PATH;
    }

}


可是TP提示:

Model:getIndexDepart您所请求的方法不存在!


求解


------解决方案--------------------
PHP code
class IndexAction extends Action{    public function index()    {        $a = D('Department');[color=#FF0000]        get_class($a);[/color]        echo "<pre class="brush:php;toolbar:false">";        print_r($a->getIndexDepart());        echo "
"; //echo THINK_PATH; }}
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn