在cakephp中定义常量 [英] where to define constants in cakephp

查看:99
本文介绍了在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:


  1. 定义方便功能。

  2. 注册全局常量

  3. 定义其他模型,视图和控制器路径。 / li>
  4. 创建缓存配置。

  5. 配置变形。

  6. 加载配置文件。

  1. Defining convenience functions.
  2. Registering global constants.
  3. Defining additional model, view, and controller paths.
  4. Creating cache configurations.
  5. Configuring inflections.
  6. Loading configuration files.

完成手册此处

这篇关于在cakephp中定义常量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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