namespace missing ?

Hi everyone:

 why don't i modify namespace "app\controllers" to "abc\controllers", and i setted alias(Yii::setAlias('@abc', dirname(__DIR__)); ) in web/index.php.


 


 run some mistake appeared as follow:


 Unable to find 'app\controllers\DefaultController' in file: /xxx/abc/controllers/DefaultController.php. Namespace missing? 








 ./controllers/DefaultControllers:


 <?php 


   namespace app\controllers;


   class DefaultController extends \Yii\web\Controller{}


   


   but i modified:


  ./controllers/DefaultControllers:


  <?php 


  namespace abc\controllers;


  class DefaultController extends \Yii\web\Controller{};





  and in web/index.php:


  Yii::setAlias("@abc", dirname(__DIR__));





  some mistake appeared:


  Unable to find 'app\controllers\DefaultController' in file: /xxx/abc/controllers/DefaultController.php. Namespace missing? 








 what's wrong?Thanks.

app it is not alias, it is namespace for your controller. Look to autoloader. Composer.phar generate autoloader. Here documentation http s://getcomposer.org/doc/01-basic-usage.md#autoloading