开发者

Can I call a custom class in the cakephp framework

开发者 https://www.devze.com 2023-03-27 02:30 出处:网络
I am new to开发者_StackOverflow社区 cakePHP, I have write a class in MODEL with name of myClass() and I have one function like func().

I am new to开发者_StackOverflow社区 cakePHP,

I have write a class in MODEL with name of myClass() and I have one function like func().

CODE:

class myClass(){
    function func(){
        echo "test";
    }

}

But I don't know how to call the "myClass class" and run the function func() in the controller file in the cakePHP framework.


Of-course you can http://book.cakephp.org/view/943/Loading-Vendor-Files

App::import('Vendor', 'myClass');
$class = new myClass();
0

精彩评论

暂无评论...
验证码 换一张
取 消