2009年10月28日星期三

Re: [fw-mvc] how to use APPLICATION_ENV

The default error.phtml created by zf.sh tests the APPLICATION_ENV constant to determine if exception information should be displayed. If it's set to "development", then exception information is displayed. Is there a better way for it to determine this without using the constant?

--
Hector


On Wed, Oct 28, 2009 at 2:26 PM, Brenton Alker <brenton@tekerson.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

huajun qi wrote:
> I  know zend defines a APPLICATION_ENV variable in the index.php file,
> but we don't see it is used explicitly. Is it used in zend source code?

It's not used internally, no. So, you could rename it (or not set it)
without problem. The only way it is used is when you instantiate
Zend_Application you tell it which section of the config
(application.ini by default) you want to load.

> Does it have some usage to help develop?

You often have different sections of the config file (application.ini)
for each environment. By default, one for testing/staging/production.
Usually, the majority of the configuration is in production and the
others inherit from that.

You can then override values in the other sections. This can be used to
do things like override the database configuration, to use SQLite for
testing, or a separate MySQL instance for staging.

Hope that helps.

- --

Brenton Alker
PHP Developer - Brisbane, Australia

http://blog.tekerson.com/
http://twitter.com/tekerson

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkrotwAACgkQ7bkAtAithuv4UwCfYTPeVj+McP94lz4OEm0NN48x
ojcAn3IE3ofwyL2s8Q4quvR+3XBe+UEC
=AGUq
-----END PGP SIGNATURE-----


没有评论: