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

WBOY
Release: 2016-06-13 10:05:27
Original
858 people have browsed it

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

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


控制器
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 " 
Copy after login
";
        //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 "
Copy after login
"; //echo THINK_PATH; }}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!