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'; } }
Nice Blog , This is what I exactly Looking for , Keep sharing more blog .
ReplyDeleteHire Yii Developers in India
Useful content! Businesses can Hire Yii developers from HireFullStackDeveloperIndia to rapidly build scalable PHP Programs.
ReplyDelete