《PHP學(xué)習(xí):Yii隱藏URL中index.php的方法》要點(diǎn):
本文介紹了PHP學(xué)習(xí):Yii隱藏URL中index.php的方法,希望對您有用。如果有疑問,可以聯(lián)系我們。
相關(guān)主題:YII框架
PHP實(shí)例本文實(shí)例講述了Yii隱藏URL中index.php的方法.分享給大家供大家參考,具體如下:
PHP實(shí)例一、修改config/下的main.php里的:
PHP實(shí)例
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
PHP實(shí)例二、修改網(wǎng)站根目錄下.htaccess文件內(nèi)容如下:
PHP實(shí)例
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
PHP實(shí)例更多關(guān)于Yii相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Yii框架入門及常用技巧總結(jié)》、《php優(yōu)秀開發(fā)框架總結(jié)》、《smarty模板入門基礎(chǔ)教程》、《php日期與時間用法總結(jié)》、《php面向?qū)ο蟪绦蛟O(shè)計入門教程》、《php字符串(string)用法總結(jié)》、《php+mysql數(shù)據(jù)庫操作入門教程》及《php常見數(shù)據(jù)庫操作技巧匯總》
PHP實(shí)例希望本文所述對大家基于Yii框架的PHP程序設(shè)計有所幫助.
轉(zhuǎn)載請注明本頁網(wǎng)址:
http://www.fzlkiss.com/jiaocheng/5683.html