6

「エラー」ビューをレンダリングするときにこのエラーが発生します

ApiController cannot find the requested view "error".

すべてのディレクトリは小文字です。Linux マシンで Yii を実行しています

Sample Code:

class ApiController extends Api
{
    private $api;
    private $placesapikey;

public function __construct()
{
    parent::__construct("Api");
    $uri = explode('=', Yii::app()->request->getQueryString());
    $this->api = end($uri);
    $this->placesapikey = "";

    if ($this->api != Yii::app()->params['apikey'] || $this->api == '')
    {
        $error['data']['title'] = "Un-Authorized Access";
        $error['data']['message'] = "You are not authorized to access or view this area";
        $this->render('error', $error);
        exit;
    }
}
4

1 に答える 1

11

試す:

$this->render('/api/error', $error);
于 2012-05-25T08:16:58.173 に答える