[PHP] Simple installation and use of Yaf framework, yaf framework_PHP tutorial

WBOY
Release: 2016-07-12 08:52:24
Original
1026 people have browsed it

[PHP] Simple installation and use of Yaf framework, yaf framework

PHP extension framework developed by PHP development team Niao Ge Hui Xinchen

Install

Windows download extension: https://pecl.php.net/package/yaf/2.2.9/windows

Select according to your computer system and PHP version number. NTS is thread-unsafe and TS is thread-safe

According to phpinfo(), choose whether it is thread-safe

Put the php_yaf.dll extension into the ext directory

Restart apache

Use

Create a new directory public and create a new file index.php entry file

<?<span>php
define(</span>"APP_PATH",  realpath(dirname(__FILE__) . '/../')); <span>/*</span><span> 指向public的上一级 </span><span>*/</span><span>
$app  </span>= <span>new</span> Yaf_Application(APP_PATH . "/conf/application.ini"<span>);
$app</span>->run();
Copy after login

Create a new directory conf and create a new file application.ini

<span>[product]
;支持直接写PHP中的已定义常量
application</span>.directory=APP_PATH "/application/" 
Copy after login

Create a new directory application/controllers and create a new file index.php

<?<span>php
</span><span>class</span> IndexController <span>extends</span><span> Yaf_Controller_Abstract {
   </span><span>public</span> <span>function</span> indexAction() {<span>//</span><span>默认Action</span>
       <span>$this</span>->getView()->assign("content", "Hello Yaf"<span>);
   }
}</span>
Copy after login

Create a new directory views/index and create a new file index.phtml

<h1><?php <span>echo</span> <span>$content</span>;?></h1>
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1127371.htmlTechArticle[PHP] Simple installation and use of Yaf framework, php extension developed by Niao Ge Hui Xinchen, the yaf framework PHP development team Framework installation windows download extension: https://pecl.php.net/package/yaf/2.2.9/windows According to...
Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template