Yaf basic learning summary 4-Yaf configuration file

Source: Internet
Author: User
In the helloyaf in the previous section, we have already touched on the yaf configuration file. Yaf shares a configuration space with the user, that is, the configuration in the configuration file given at the time of Yaf_Application initialization. as a difference, Yaf configuration items start with ap. in the hello yaf in the previous section, we have already touched the yaf configuration file. Yaf shares a configuration space with users, that is, the configuration in the configuration file provided at the time of Yaf_Application initialization. as a difference, all configuration items of Yaf start with ap. the Yaf core has only one essential configuration item (in fact, this can also have default parameters, but the author thinks it is too shabby to have no configuration ).

Yaf selects different configuration sections in different environments, and combines the configuration inheritance to implement a set of configurations to adapt to multiple environments (online, testing, and development ).
Yaf is an essential configuration item, that is, the absolute path for configuring the application project.
Application. directory

The configuration for this item in the previous section is


Application. directory = APP_PATH "/application /"

In the configuration, we can directly use the defined PHP constant, as shown in the above APP_PATH



Optional Yaf configuration items

In addition, Yaf has some optional configuration items, which are optional. In fact, the framework has already specified default values for these Configuration Items. we can directly use these default values. of course, to meet our project needs, we may need to define our own values for these Configuration Items. the meanings and default values of these configuration items are listed below.

The default extension of the application. ext PHP script is php.

Application. bootsttrap Bootstrap path (absolute path) default value: Bootstrapapplication. php

The absolute directory address of the local (own) class library of application. library is application. directory + '/Library' by default'
The path prefix that application. baseUri needs to ignore in the route. Generally, you do not need to set the prefix. Yaf automatically determines
Application. dispatcher. defaultModule default module default value: index
Application. dispatcher. defaultController default controller, default value: index
Application. dispatcher. defaultAction default action, default value: index
The default extension of the application. view. ext view template file is phtml (note that the template file name in the previous section is index. phtml)
Application. dispatcher. throwException: whether to run the exception when an error occurs. the default value is true.
Application. dispatcher. whether to use the default exception capture controller for catchException. if it is enabled, the control is handed over to the errorAction method of ErrorController when an uncaptured exception occurs. that is, the program will go to the errorAction of the Error controller, you can use $ request-> getException () to obtain the thrown exception object. the default value is false.
Application. modules declares the pure Module name. Note that if you want to define this value, you must define the Index Module.
Application. system. * through this attribute, you can modify the runtime configure of yaf, such as application. system. lowcase_path. However, note that only the PHP_IN_ALL configuration item can be modified here.

This is a simple introduction to Yaf configuration. in the future, we will explain the format, definition, and reading method of the Yaf configuration file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.