I’ve just created the “UserController” file with the gii tool, but when I write “http://localhost/yii2advanced/frontend/web/index.php?r=user/index” it appears the following error:

[b]Unknown Class – yii\base\UnknownClassException

Unable to find ‘frontend\controllers\UserController’ in file: C:\xampp\htdocs\yii2advanced/frontend/controllers/UserController.php. Namespace missing?[/b]

However, the "UserController" file exists.

assuming you have user model in the default location, which is common\models, you need to make sure you have the namespace on the user model:

namespace common\models;

And for the controller, you need to have the use statement:

use common\models\user;

If you have the user model somewhere else, make sure you have adjusted the namespaces.