huadie 2011-10-26 14:40:22 3179次浏览 5条回复 0 0 0

为什么在系统自带的sitecontroller里面可以隐藏,而我新建了个controller就不可以了。代码如下 这个是main.php

return array(
    'components'=>array(
        'urlManager'=>array(
            'urlFormat'=>'path',
            'showScriptName' => false,
            'rules'=>array(
                'posts/<tag:.*?>'=>'post/index', 
                'site/guess/<g:\w>'=>'game/guess',
                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
            ),
        ),
    ),
);

在更目录添加.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

我新建的Postcontroller.php

<?php
class PostController extends CController
{
    public function actionIndex(){
        echo "ddd";
        //$this->render('index');
    }
}
?>

localhost/yiitest/site 可以 而 localhost/yiitest/post/ 不可以必须加上index.php才可以。请问是什么问题啊

您需要登录后才可以回复。登录 | 立即注册