Directory structure
+ Public < span=""> < span=""> < span=""> < span=""> < span=""> +application/+< span="">< span=""> < span=""> < span=""> < span="">< span="">< span=""> +< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">
Entry file
The portal file is the entry for all requests, and it is generally the rewrite rule that redirects all requests to the portal file.
A classic entry file public/index.php
< span="">("App_path", < span="">(< span="">(< span="">< span="">< span="">< span="">< < span=""> /c16> yaf_application< span=""> (App_path. "/conf/application.ini"< span="">< span="">->run ();
Rewrite rules
Unless we use the routing protocol based on query string (yaf_route_simple, Yaf_route_supervar), we will need to use the rewrite rules provided by webserver to put all requests for this application, are directed to the entry file mentioned above.
Modify the. htaccess file
Nginx's rewrite (nginx.conf)
< span="">< span="">< span="">< span="">< span="">(-^/(. *) /index.php/$< span="">< span="">
Configuration file
In Yaf, the configuration file supports inheritance and supports sub-sections. and support for the constants of PHP. You don't have to worry about the configuration file too large to cause parsing performance problems, because YAF will load the configuration file at the first run and keep the formatted content in memory. The configuration file will not be loaded again until it has been modified.
A simple configuration fileapplication/conf/application.ini
< span="">= < span=""> app_path < span=""> < span=""> < span=""> < span=""> < span="">< span="">< span="">< span="">< span="">< c24>< span="">=< span="">
Controller
In Yaf, the default module/Controller/action is named by index, which is, of course, modified by the configuration file.
For the default module, the controller directory is under the Controllers directory in the application directory, and the Action naming convention is "name +action"
Default Controllerapplication/controllers/Index.php
< span="">< span="">< span="">< span="">< span="">< span="">< span="">indexaction () {< span="">->getview ()->assign (" Content "," Hello World "< span="">?>
View File
YAF supports a simple view engine and enables users to customize their own view engine, such as Smarty.
For the default module, the path to the view file is in the directory with the lower case action name in the Views directory under the application directory.
A view of the default actionapplication/views/index/index.phtml
Hello YAF
< span="">
Then in the browser enter the nginx.conf settings of the ServerName,< span="">< span="">
Table 4.2. Yaf Optional Configuration Items
name |
value type |
Default Value |
Description |
Application.ext |
String |
Php |
The extension of the PHP script |
Application.bootstrap |
String |
bootstrapplication.php |
Bootstrap path (absolute path) |
Application.library |
String |
Application.directory + "/library" |
The absolute directory address of the local (own) class library |
Application.baseuri |
String |
Null |
In the route, the path prefix that needs to be ignored, generally does not need to set, YAF will automatically judge. |
Application.dispatcher.defaultModule |
String |
Index |
The default module |
Application.dispatcher.throwException |
Bool |
True |
Whether to throw an exception when an error occurs |
Application.dispatcher.catchException |
Bool |
False |
Whether to use the default exception capture controller, if open, when there is an uncaught exception, control will be given to the Errorcontroller ErrorAction method, can be $request->getexception () Get this exception object |
Application.dispatcher.defaultController |
String |
Index |
The default controller |
Application.dispatcher.defaultAction |
String |
Index |
The default action |
Application.view.ext |
String |
Phtml |
View template Extension |
Application.modules |
String |
Index |
Declare the module name that exists, be aware that if you want to define this value, be sure to define the index module |
application.system.* |
String |
* |
With this property, you can modify the YAF runtime configure, such as Application.system.lowcase_path, but note that only the Php_ini_all configuration items can be modified here, This option has been introduced from 2.2.0
|
http://www.bkjia.com/PHPjc/440265.html www.bkjia.com true http://www.bkjia.com/PHPjc/440265.html techarticle directory structure + public-index.php-. htaccess + |-Application.ini application/+-index.php + |+ index-index.phtml + modul Es-library-models-plugins Portal File Entry file ...