Create action in Yii2
Yii actions define public under the controller class. It starts with action keyword and it can be camel case like actionTestScript.
Yii Url format like: controller/action.
In below example controller name is sample and action name is TestScript, So if you want to access this controller/action, You need to write like sample/test-script.
Another example is sample/home.
use yii\web\Controller;
namespace app\controllers;
class SampleController extends Controller
{
public function actionTestScript($params)
{
return $this->render('test');
}
public function actionHome()
{
return 'This is my controller';
}
}