当前位置:主页 > 查看内容

PHP Yaf(Yet Another Framework) 扩展及框架部署

发布时间:2021-05-17 00:00| 位朋友查看

简介:查看本机配置 终端输入命令 php -v $ php -vPHP 7.4.3 (cli) (built: Feb 18 2020 17:29:57) ( NTS Visual C 2017 x64 )Copyright (c) The PHP GroupZend Engine v3.4.0, Copyright (c) Zend Technologies 本机环境windows10 PHPstudy PHP7.4.3 NTS Nginx1.1……
查看本机配置

终端输入命令php -v

$ php -v
PHP 7.4.3 (cli) (built: Feb 18 2020 17:29:57) ( NTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

本机环境:windows10 PHPstudy PHP7.4.3 NTS + Nginx1.15

先附上链接地址懒得找

yaf 扩展下载地址:https://pecl.php.net/package/yaf
yaf github项目地址 : https://github.com/laruence/yaf
yaf 框架文档:https://www.laruence.com/manual/
yaf 扩展文档:https://www.php.net/manual/zh/book.yaf.php

下载yaf

要使用yaf首先要开启PHP的yaf扩展官网下载

一,选择对应版本,楼主用的PHP7.4所以下载的最新版本3.3.2
找到php对应版本
二,通过phpinfo()选择NTS 还是TS的版本,以及X86或者X64
在这里插入图片描述
三,disable线程非安全选择:
在这里插入图片描述

加载yaf扩展

将下载完的yaf扩展解压,把里面的 php_yaf.dll移到对应的php版本的ext目录下

如: D:\phpstudy_pro\Extensions\php\php7.4.3nts\ext

修改php.ini

在对应PHP版本的php.ini 加入yaf扩展,保存并重启服务

extension=php_yaf.dll
检查模块是否加载成功

终端输入命令php -m,看到yaf说明就已经配置成功

$ php -m
[PHP Modules]
......  
yaf
......

[Zend Modules]
编译yaf demo

yaf项目地址 : https://github.com/laruence/yaf
clone下项目
cd 进yaf/tools/cg目录,通过yaf_cg工具新建一个test项目

git clone https://github.com/laruence/yaf.git yaf
cd /yaf/tools/cg
php yaf_cg -d test
看到输出done则已成功了

在这里插入图片描述
yaf_cg工具生成的test目录复制到根目录,然后启动:Nginx,到了这一步我们的框架已经生成好了

目录结构

+ public
  |- index.php //入口文件
  |- .htaccess //重写规则    
  |+ css
  |+ img
  |+ js
+ conf
  |- application.ini //配置文件   
+ application
  |+ controllers
     |- Index.php //默认控制器
  |+ views    
     |+ index   //控制器
        |- index.phtml //默认视图
  |+ modules //其他模块
  |+ library //本地类库
  |+ models  //model目录
  |+ plugins //插件目录
;原文链接:https://blog.csdn.net/weixin_44972284/article/details/115483421
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!

推荐图文


随机推荐