问题描述
是一个正确的方法使一些变量可用于所有我的控制器添加 MY_Controller.php
文件在我的 / application / libraries /
文件夹()?
Is the proper way to make a few variables available to all my controllers to add a MY_Controller.php
file in my /application/libraries/
folder (shown in the docs here)?
我在Kohana 2.3.4工作,想知道是否有更好的方法,或者这是唯一推荐的方法吗?
I'm working in Kohana 2.3.4 and wondering if there are any better ways to do it, or is this the only recommended method?
作为新的OOP,你能链接到任何例子吗?
Being new to OOP, can you link me to any examples?
我听说正确的答案是添加vars到你的 $ config []
,尝试获取更多详细信息。
I've heard the right answer is to add the vars to your $config[]
, trying to get more details.
推荐答案
创建自定义配置文件(application / config / foobar.php),并使用Kohana :: config('foobar.key')访问数据。
The proper way is to make a custom config file (application/config/foobar.php), and access the data with Kohana::config('foobar.key').
点火器的方式完全错误和不当。
The code igniter way is completely wrong and inappropriate.
查看
这篇关于为Kohana 2.3.4中的所有控制器设置全局变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!