开发者

include file in action.class.php ? symfony

开发者 https://www.devze.com 2023-04-06 01:52 出处:网络
i have library in file Example.php. I would like this include for action.class.php. How can i 开发者_如何学Cmake this?

i have library in file Example.php. I would like this include for action.class.php. How can i 开发者_如何学Cmake this? In template i can make partial and use include_partial, but how can make somethings in action?


An easy - and symfony like - way would be to make a class file and store it in the lib directory, so the symfony autoloader will provide them all over your project.

Example.class.php :

Class Example {
    static public function myFoo(){
        return true;
    }
}

actions.class.php :

public function executeFoo($request){
    /* snip */
    $this->foo = Example::myFoo();
    /* snip */
}
0

精彩评论

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