Home  >  Article  >  Backend Development  >  [PHP] Simple installation and use of Yaf framework

[PHP] Simple installation and use of Yaf framework

WBOY
WBOYOriginal
2016-07-29 08:48:471232browse

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

Installation

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

According to your own computer system and PHP version number selection, NTS is thread-unsafe, TS is thread-safe

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

[PHP] Yaf框架的简单安装使用

Put the php_yaf.dll extension in the ext directory

Restart apache

Use

Create a new directory public, 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();

New directory conf, create a new file application.ini

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

New directory application/controllers, 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>

New directory views/index, create a new file index.phtml

<h1><?php <span>echo</span><span>$content</span>;?></h1>

[PHP] Yaf框架的简单安装使用

The above introduces the simple installation and use of [PHP] Yaf framework, including php and ya content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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