Manikandan Thangaraj
Manikandan Thangaraj

Reputation: 33

Can I call a custom class in the cakephp framework

I am new to 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.

Upvotes: 0

Views: 610

Answers (1)

RSK
RSK

Reputation: 17516

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

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

Upvotes: 2

Related Questions