开发者

Where/how to store custom functions (or methods) in CakePHP

开发者 https://www.devze.com 2023-03-07 20:00 出处:网络
i need to have several function开发者_JAVA百科s in cakephp application (for some regular expression matching).

i need to have several function开发者_JAVA百科s in cakephp application (for some regular expression matching).

which is best way to store them, so i can access to them in every controller action?

tnx in adv!


Or, if the actions aren't typical controller actions - you could store them in either a component (available to controllers) then include the component in your AppController.. or you could put the file in the vendors folder and use App::import to load the file into the bootstrap.php


I would recommend you store the functions in the AppController class. All of your controller classes inherit from this controller.

Also create the app_controller.php file in the root folder of your application if you have not already.

0

精彩评论

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