qiqing

qiqing

这家伙有点懒,还没写个性签名!

  • 财富值5
  • 威望值0
  • 总积分15

个人信息

  • 回复了 的回复

    最近在评估YII 2.0,实现perfy url的步骤如下 1 和 2
    1.在 index.php 同级目录建立 .htaccess 文件 ,设置内容:

    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`
    

    2.为 config目录的web.php 增加配置项 urlManager,代码:

    'urlManager' => [		
        'class' => 'yii\web\UrlManager',
        // Disable index.php
        'showScriptName' => false,
        // Disable r= routes
        'enablePrettyUrl' => true,
        'rules' => array(
        ),
    ],
    

    以上2个步骤下来,There is Pretty URL ! ~(≧▽≦)/~
    内容引用源:http://www.bsourcecode.com/yiiframework2/removing-index-php-from-url-in-yiiframework-2-0/

    index.php前边加个?

实习生 等级规则
15/20
资料完整度
10/100
用户活跃度
0/100

Ta的关注

1

Ta的粉丝

0

Ta的访客

1