友情链接
在线网页工具
FastMVC采用单一入口模式进行项目部署和访问,无论完成什么功能,一个应用都有一个统一的入口。
应该说,所有应用都是从入口文件开始的,并且不同应用的入口文件是类似的。
在根目录下定义".htaccess"的文件
<IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] </IfModule>
在根目录下定义"web.config"的文件
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="index" stopProcessing="true"> <match url="^(.*)$" /> <conditions logicalGrouping="MatchAll"> <add input="{HTTP_HOST}" pattern="^(.*)$" /> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
define('APP_PATH','./app/');
如果你改变了项目目录(例如把Application更改为Apps),只需要在入口文件更改APP_PATH常量定义即可:
define('APP_PATH','./Apps/');
注意:APP_PATH的定义支持相对路径和绝对路径,但必须以“/”结束
如果你调整了框架核心目录的位置或者目录名,只需要这样修改: