==配置文件结构==
工程\config\common.php 全局配置
工程\config\database.php 数据库相关
工程\config\子项目.php 工程项目特有 例: \config\admin.php 作用于 admin 项目
==Action==
工程\子项目\action\xxxAction.php 例: admin\action\testAction.php
==路由配置与缓存==
建议放在 config\子项目.php
/*自定义规则
* 规则 => [目标,缓存时间]
* 例: /admin/index.php/test/123?s=1 规则 '\/test\/(\d+)$'=> ['test/index',0] 将 test/数字 转到 test/index 可以用 $_GET[preg_0] 获取到 123
* 例: /admin/index.php/test/123abc?s=1 规则 '\/test\/(\d+)(\w+)'=> ['test/index',0] 将 test/数字 转到 test/index 可以用 $_GET[preg_route][0] 获取到 123 $_GET[preg_route][1] 获取到 abc
* 缓存时间 单位 秒,0 为不缓存, 9 为永久缓存.
*/
'ROUTE' => [
'\/test\/(\d+)(\w+)'=> ['test/index',0]
],
缓存目录自动创建 工程\子项目\cache
==Appache 重写规则==
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
#文件存在,直接访问文件
RewriteCond %{REQUEST_FILENAME} !-f
#找不着实际路径的文件,统一交给index.php处理
RewriteRule ^(.*)$ /ypmvc/3.0/admin/index.php/$1 [QSA,PT,L]
==Nginx 重写规则==
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /ypmvc/3.0/admin/index.php/$1 last;
break;
}
}
==静态文件路由==
index.php/xxx1/xxx.html 将加载 项目\tpl\xxx\xxx.php