There is such a controller:

<?php namespace app\controllers; use Yii; use yii\filters\AccessControl; use yii\web\Controller; use yii\filters\VerbFilter; use app\models\LoginForm; use app\models\ContactForm; class StockController extends Controller{ public function behaviors(){ return [ 'access' => [ 'class' => AccessControl::className(), 'only' => ['logout'], 'rules' => [ [ 'actions' => ['index'], 'allow' => true, 'roles' => ['*'], ], ], ], 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [ 'logout' => ['post'], ], ], ]; } public function actions(){ return [ 'error' => [ 'class' => 'yii\web\ErrorAction', ], 'captcha' => [ 'class' => 'yii\captcha\CaptchaAction', 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, ], ]; } public function actionIndex(){ var_dump("index work");die(); return $this->render('index'); } public function actionGGList(){ var_dump("list work");die(); return $this->render('gglist'); } } 

Action index works as it should, but gglist gives a 404 error:

enter image description here

PS

it began to happen after work GII

  • The actionGGList action from your controller will be available at: stock/gg-list , because all capital letters after the first turn into a dash in front of them, here you can read: yiiframework.com/doc-2.0/… - MasterAlex

1 answer 1

The names of action names are case-sensitive. For example, if you have an ActionIndex method, it will not be counted as an action method, so a request to the index action will throw an exception.

In your case, the action contains the name actionGGList , in which case you need to contact the controllerName / gg-list .

Also note that action methods must have a public scope. Methods that have a scope of private or protected do NOT define methods of embedded actions.

Details here: Read