开发者

include file in action.class.php ? symfony

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜