Yii:系统无法找到请求的操作 "select"

Yii: The system is unable to find the requested action "select"

我正在做的是尝试使用 yii select2 扩展来创建一个可搜索的下拉列表。我已经从这个 link 下载了扩展程序并跟随它“http://www.yiiframework.com/extension/select2/”。 我已将解压缩的文件(即 select2)放在 protected/extensions 中,然后在 "protected/views/site/select.php" 中创建了一个 php 文件,我在其中粘贴了下面的代码,当我尝试 运行 它通过 "webapp/index.php/site/login" 它给出了这个错误“ 错误 404 系统无法找到请求的操作 "select"。”请帮我解决这个问题,谢谢..!!

 //code in select.php(protected/views/site/select.php)
$tags=array('Satu','Dua','Tiga');
echo CHtml::textField('test','',array('id'=>'test'));
$this->widget('ext.select2.ESelect2',array(
'selector'=>'#test',
'options'=>array(
'tags'=>$tags,
),
));

看来您已经制作了视图文件(protected/views/site/select.php)但是您还没有创建相应的动作。

加入SiteController:

public function accessRules() {
    //You can modify accordingly but you have to insert select to allowable actions
   return array(
        array('allow',  // allow all users to perform 'index', 'contact' and 'select' actions
            'actions'=>array('index', 'contact', 'select'),
            'users'=>array('*'),
        ),
        array('deny',  // deny all users
            'users'=>array('*'),
        ),
    );
}

 public function actionSelect() {
    $this->render('select');
}