YAF, full name yet another framework, is a C language written PHP framework, [1] is a php extension in the form of a PHP development framework, compared to the general PHP framework, it is faster and lighter. It provides bootstrap, routing, distribution, views, plugins, and is a full-featured PHP framework. In this section we will talk about the YAF-based Hello World example, assuming that the site directory for my example is/var/www/yaf_test, the directory structure I am using is as follows:
-index.php//Entry file + public |-htaccess//rewrite rules |+ CSS |+ img |+ js + conf |-Application.ini//profile + APPL Ication |+ Controllers |-index.php//Default controller |+ views |+ Index//Controller |-index.phtml//default view |+ Modules//Other modules |+ Library//local class library |+ models//model directory |+ plugins//Plugin Directory
Writing the Portal file index.php
<?php //point to Web site root directory define ("App_path", dirname (__file__)); $app = new Yaf_application (App_path. ") /conf/application.ini "); $app->run ();
Edit public/.htaccess rewrite rule (Apache)
Rewriteengine on rewritecond%{request_filename}!-f rewriterule. * index.php
Editing a configuration file Conf/application.ini
[Product] Application.directory=app_path "/application/"
Edit Default Controller application/controllers/index.php
<?php class Indexcontroller extends yaf_controller_abstract{public function indexaction () { $this- >getview ()->assign ("Content", "Hello World"); } }
Edit View File templates/index/index.phtml
After the above operation, in the browser input site 127.0.0.1/yaf_test can see the output of Hello World, if not, please check whether the above steps do the right!
The above is a simple yaf-based Hello World example, if you have questions welcome to the consultation OH.