One. The portal file is the entry for all requests, usually with the aid of the rewrite (regular) rule, which redirects all requests (
Redirection (Redirect) is the way in which various network requests are redirected to another location through various methods to the portal file.
Example 3.2. A classic entry filepublic/index.php
<?phpdefine ("App_path", Realpath (dirname (__file__). ‘/.. /‘)); /* The upper-level * ////definition constant pointing to public app_path $app = new Yaf_application (App_path. "/conf/application.ini"); $app->run ();
$app = new Yaf_application (App_path. "/conf/application.ini");//Initialize a Yaf_application object based on the path's file
An understanding of the *.ini document There is an example on the Internet
http://clisvoi.blog.163.com/blog/static/20149805020151710726737/
public void yaf_application::run ( void)
Runs a yaf_application, starts accepting and processing requests, distributes routes, and responds accordingly. The response is eventually returned to the client
Two. 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.
Example 3.4. Nginx's rewrite (nginx.conf)
server { Listen * * *; server_name domain.com; Root document_root; Index index.php index.html index.htm; if (!-e $request _filename) { rewrite ^/(. *) /index.php/$1 last; }}
Yaf learn to start from the beginning