🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
* 码云仓库:[https://gitee.com/zhqings/zqphp](https://gitee.com/zhqings/zqphp) * zqphp结合workerman从4.x版本开发。 * 支持Workerman Swoole(开发中) Apache Nginx iis Cli 访问 * 如要支持Workerman访问,项目内不能使用exit,die函数,可以使用方法`come($Data=null)`方法代替 * PHP版本要求:`php-7.1`或更高版本 * [WorkerMan的特性](http://doc.workerman.net/getting-started/feature.html) ***** * [ ] 创建index.php文件 ``` <?php //引加文件 require __DIR__ . '/zqphp/AutoLoad.php'; $Obj = new \zqphp\AutoLoad(__DIR__ . '/application'); $Obj->Run('8080'); ``` ***** * 创建文件application/Lib/index.php ``` <?php class index{ public function main() { echo 'Hello'; } } ``` ***** * [ ] Workermany启动 php index.php start 访问 `http://127.0.0.1:8080/index/main` * [ ] Cli访问 `php index.php index/main` * [ ] Apache Nginx IIS 没有伪静态也可以通过访问 `/index.php/index/main` * [ ] Apache Nginx IIS 伪静态 访问` /index/main` ***** Apache伪静态(`.htaccess`) ``` <IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,PT,L] </IfModule> ``` ***** Nginx伪静态 ``` if (!-d $request_filename){ set $rule_0 1$rule_0; } if (!-f $request_filename){ set $rule_0 2$rule_0; } if ($rule_0 = "21"){ rewrite ^/(.*)$ /index.php last; } ``` ***** iis伪静态(`web.config`) ``` <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="index" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false"/> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true"/> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true"/> </conditions> <action type="Rewrite" url="index.php/{R:1}" appendQueryString="true"/> </rule> </rules> </rewrite> </system.webServer> </configuration> ``` ***** * [ ] 目录结构 ``` zqphp 框架目录(此目录下的类取消自动加载) ├─Config 配置目录 │ ├─Config.php 默认配置文件 │ ├─ErrInfo.php 自定义报错内容 │ ├─Mime.Types 默认Mime类型 ├─Events 扩展目录(此目录的类使用时会自动加载) │ ├─GatewayClient GatewayClient │ ├─GatewayWorker GatewayWorker框架 │ ├─Medoo Medoo Mysql │ ├─think 第三方从Thinkphp分离出来的Mysql(zqphpMysql正在开发中) │ ├─Workerman Workerman框架 │ ├─zqphp zqphp旧版本类 │ ├─Cookie.php Cookie类 │ ├─Frame.php 框架函数类 │ ├─GlobalVariables.php 全局变量类 │ ├─Request.php 请求类 │ ├─Response.php 响应类 │ ├─Session.php Session类 │ ├─TempLets.php TempLets模板类 ├─Public 框架方法目录(此目录文件会自动加载) │ ├─FrameWay.php 框架函数(框架类中调出来的) │ ├─ResponseWay.php 响应函数(响应类中调出来的) ├─AutoLoad.php 框架主加载文件 ```