Налаштування під час виконання

На поведінку цих функцій випливають налаштування в php.ini.

Yaf Параметри конфігурації
Назва Початково Де можна змінювати Журнал змін
yaf.library "" INI_ALL  
yaf.environ "product" INI_SYSTEM  
yaf.forward_limit 5 INI_ALL  
yaf.use_namespace 0 INI_ALL  
yaf.action_prefer 0 INI_ALL  
yaf.lowcase_path 0 INI_ALL  
yaf.use_spl_autoload 0 INI_ALL  
yaf.name_suffix 1 INI_ALL  
yaf.name_separator "" INI_ALL  

Тут є коротке пояснення директив конфігурації.

Зауваження:

The yaf.cache_config directive existed in Yaf 2.x, where it cached the parsed result of the INI configuration file within the PHP process. It was removed in Yaf 3.0.0 and is no longer recognized.

yaf.library string

The global library directory. Yaf_Loader searches this directory for classes that can not be found in the application's local library (see application.library).

See also Yaf_Loader::getLibraryPath() and Yaf_Loader::setLibraryPath().

yaf.environ string

The environment name, "product" by default. It is used by Yaf_Application to pick the section of the INI configuration file (its first constructor argument) that becomes the application configuration.

For example, if this value is "product", Yaf will use the section named [product] in the INI configuration file as the final configuration of the Yaf_Application. The environment name can also be overridden per application by passing the second constructor argument to Yaf_Application::__construct().

yaf.forward_limit int

The maximum number of times Yaf_Controller_Abstract::forward() can be chained in a single request, 5 by default.

This is a protection against recursive Yaf_Controller_Abstract::forward() loops; when the limit is exceeded, a Yaf_Exception_DispatchFailed is thrown. Non-positive values are clamped to the default.

yaf.use_namespace int

When enabled, all classes declared by Yaf are named in namespace style:

Yaf_Route_Rewrite => \Yaf\Route\Rewrite
Yaf_Request_Http  => \Yaf\Request\Http

There is an exception for classes whose last component is a reserved keyword of PHP and thus cannot be used as a class name; such classes keep the underscore in their last component:

Yaf_Controller_Abstract => \Yaf\Controller_Abstract
Yaf_Route_Static        => \Yaf\Route_Static

Зауваження:

Only one of the two naming styles is registered when the extension starts, so this directive must be set before the extension is loaded; it can not be toggled per request in any meaningful way.

yaf.action_prefer int

When there is only one part in the PATH_INFO, decides whether it should be considered as a controller name or as an action name.

If this configure is on, the single segment is considered as an action name, and the controller name falls back to the default controller; otherwise it is considered as a controller name.

yaf.lowcase_path int

Whether to lowercase all path components during class autoloading.

yaf.use_spl_autoload int

When this value is on, if Yaf_Loader can not find a class, it will return false, giving other autoload functions a chance to be called.

When this value is off (the default), if Yaf_Loader can not find a class, it will return true, and the class autoloading fails immediately: Yaf_Loader::autoload() always returns true in that mode.

Зауваження:

Yaf registers its loader during the instantiation of a Yaf_Application, so any other autoloaders registered before the instantiation will be called before Yaf_Loader::autoload().

yaf.name_suffix int

When this is on (the default), Yaf_Loader identifies an MVC class by its suffix to decide whether it is a controller or an action class: IndexController, IndexAction.

When this is off, Yaf_Loader looks at the prefix of the class name instead: Controller_Index, Action_Index.

yaf.name_separator string

When this is not empty, Yaf_Loader identifies MVC classes by this separator instead of the underscore that separates the name and the MVC suffix.

For example, when this value is "_" and yaf.name_suffix is on, Yaf_Loader will take Index_Controller as a controller class, while IndexController is considered a normal class. When it is empty (the default), the underscore is used.

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top