1、URL访问
访问HelloWorld 驼峰式控制器,前后单词小写中间以_下连接
http://www.tp5.com/admin/hello_word/index/name/yeguoxiong/li/xiero/number/123123
echo yeguoxiong
也可以通过配置 "URL设置"->url_convert为false 就可以支持驼峰式访问
http://www.tp5.com/admin/helloWord/index/name/yeguoxiong/li/xiero/number/123123
echo yeguoxiong
2、如果你的服务器环境不支持pathinfo方式的URL,可以使用兼容方式
http://www.tp5.com/index.php?s=/admin/Index/index
echo hello:张三 女
3、隐藏index.php
官方默认的 .htaccess文件
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
如果用的phpstudy,规则如下:
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>
如果你使用的apache版本使用上面的方式无法正常隐藏index.php,可以尝试使用下面的方式配置.htaccess文件
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>