Yii controller cannot find the required view

I encounter this error when presenting an โ€œerrorโ€

ApiController cannot find the requested view "error". 

All catalogs are in small letters. I am running Yii on Linux Machine

 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; } } 
+6
source share
1 answer

Try:

 $this->render('/api/error', $error); 
+11
source

Source: https://habr.com/ru/post/916628/


All Articles