PHP开发实例大全(提高卷) 中文完整pdf扫描版[244MB]
1:打开website根目录下面protected/config/main.php配置文件,打开urlManager注释掉的,在进行修改
'urlFormat'=>'path', //使用pathinfo模式,不需要?r=
'showScriptName'=>false, //隐藏index.php
'rules'=>array( //这里面写规则
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
2:website根目录index.php同目录添加一个.htaccess内容是
Options +FollowSymLinks IndexIgnore */* RewriteEngine on # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward it to index.php RewriteRule . index.php
官方文档推荐
注意:前提得是你的apache服务器rewrite打开了.
一般配置完上面的步骤就OK了,也有会报错的情况,如.htaccess 导致 500错误 Options not allowed here,...
一般解决方案就是把相应站点配置项 AllowOverride all 切记是all ,祝你成功!
[yii 1.14准]