在cakephp中定义常量 [英] where to define constants in cakephp
本文介绍了在cakephp中定义常量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我应该在哪个文件中定义特定于我的cakephp应用程序的应用程序范围的常量?
In which file should I define application-wide constants that are specific to my cakephp app?
推荐答案
app / config / bootstrap.php
I define them in app/config/bootstrap.php
Bootstrapping CakePHP
额外的配置需要,使用CakePHP的引导文件,在app / Config / bootstrap.php中找到。此文件在CakePHP的核心引导之后执行。
If you have any additional configuration needs, use CakePHP’s bootstrap file, found in app/Config/bootstrap.php. This file is executed just after CakePHP’s core bootstrapping.
这个文件是许多常见引导任务的理想选择:
This file is ideal for a number of common bootstrapping tasks:
- 定义方便功能。
- 注册全局常量
- 定义其他模型,视图和控制器路径。 / li>
- 创建缓存配置。
- 配置变形。
- 加载配置文件。
- Defining convenience functions.
- Registering global constants.
- Defining additional model, view, and controller paths.
- Creating cache configurations.
- Configuring inflections.
- Loading configuration files.
完成手册此处
这篇关于在cakephp中定义常量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文