SETENV APPLICATION_ENV发展 - 的.htaccess与Zend框架的互动? [英] SetEnv APPLICATION_ENV development - .htaccess interacting with Zend Framework?

查看:410
本文介绍了SETENV APPLICATION_ENV发展 - 的.htaccess与Zend框架的互动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的htaccess以下。

I have the following on my htaccess.

SetEnv APPLICATION_ENV development

在我这个文件传递给脾淋巴细胞,我将其更改为:

When I pass this file to prodution, I will change it to:

SetEnv APPLICATION_ENV production

开发

生产

是在Zend框架设置的的application.ini 的是否正确?

are set on Zend Framework application.ini correct ?

如何Zend和Apache的沟通吗?如何Zend公司知道有关htaccess的指令?

感谢。

推荐答案

SETENV ,在Apache的配置中(无论是.htaccess文件或虚拟主机),定义了一个环境变量。

SetEnv, used in Apache's configuration (be it a .htaccess file, or a VirtualHost), defines an environment variable.

从PHP,你可以阅读环境变量之一:

From PHP, you can read environment variables either :


  • 使用 的getenv() 功能

  • 或者在<一个href=\"http://www.php.net/manual/en/reserved.variables.server.php\"><$c$c>$_SERVER <$c$c>$_ENV超全局变量

  • using the getenv() function.
  • Or in the $_SERVER or $_ENV superglobal variables

结果
在拍摄的的index.php 。 HTML>的Zend框架快速入门,你会看到它使用环境变量中定义了一个名为PHP恒 APPLICATION_ENV


Taking a look at the given index.php in Zend Frameworks QuickStart, you'll see it uses that environment variable the define the PHP constant called APPLICATION_ENV :

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV',
              (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV')
                                         : 'production'));

和该常量稍后用于初始化应用程序:

And that constant is later used to initialize the application :

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);

这篇关于SETENV APPLICATION_ENV发展 - 的.htaccess与Zend框架的互动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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