一、URL 解析
- 多应用(需安装扩展):http://serverName/index.php/应用/控制器/操作/参数/值 …
- 单应用:http://serverName/index.php/按制器/操作/参数/值 …
- index.php 入口文件可省略,要设置URL 重写即可:
A. apache
a. httpd.conf 配置文件中加载了 mod_rewrite.so 模块
b. AllowOverride none 将 None 改为 All;
B. nginx
server
{
listen 80;
server_name www.toplearn.com;
root "D:/wwwroot/www.toplearn.com/public";
location / {
index index.php index.html error/index.html;
if ( !-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
}
}
}
二、URL 兼容模式
- 兼容模式:http://serverName/?=按制器/操作/参数/值 …