哪里/如何在CakePHP中存储自定义函数(或方法) [英] Where/how to store custom functions (or methods) in CakePHP

查看:212
本文介绍了哪里/如何在CakePHP中存储自定义函数(或方法)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在cakephp应用程序中有几个函数(对于一些正则表达式匹配)。



这是最好的方式来存储它们,每个控制器操作?



tnx在adv!

解决方案

建议您将函数存储在 AppController 类中。所有的控制器类都继承自这个控制器。



如果您还没有在应用程序的根文件夹中创建 app_controller.php 文件。 p>

i need to have several functions 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!

解决方案

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.

这篇关于哪里/如何在CakePHP中存储自定义函数(或方法)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆