Home >Backend Development >PHP Tutorial >Installation and use of the Yaf framework of the PHP extension framework, PHP extension yaf framework_PHP tutorial
Installation
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
<?php define("APP_PATH", realpath(dirname(__FILE__) . '/../')); /* 指向public的上一级 */ $app = new Yaf_Application(APP_PATH . "/conf/application.ini"); $app->run();
Create a new directory conf and create a new file application.ini
[product] ;支持直接写PHP中的已定义常量 application.directory=APP_PATH "/application/"
Create a new directory application/controllers and create a new file index.php
<?php class IndexController extends Yaf_Controller_Abstract { public function indexAction() {//默认Action $this->getView()->assign("content", "Hello Yaf"); } }
Create a new directory views/index and create a new file index.phtml
<h1><?php echo $content;?></h1>
The above is the knowledge about the installation and use of the Yaf framework of the PHP extension framework introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. of. I would also like to thank you all for your support of the Bangkejia website!