I am trying to pass an argument(station code) to an module controller action.
Path: index.php?r=rcont/rcont/station/cod
it is redirecting to site error page(page not found)
when I try the path index.php?r=rcont/rcont/station/
It errors saying
Bad Request "Missing parameter code"
main.php
'urlManager'=> [
'class' => 'yii\web\UrlManager',
'enableStrictParsing' => true,
'rules'=> [
[
'class' => 'yii\rest\UrlRule',
'controller' => [ 'rcont/rcont'],
'only' => ['station'],
//I dont know next
]
//'rcont/rcont/station/<code>' => 'rcont/rcont/station/' not even this worked to me
],
],
main-config.php
'modules' => [
'rcont' => [
'class' => 'app\modules\rcont\Module',
],
Controller
class RcontController extends \yii\web\Controller
{
public function actionStation($code)
{
echo $code;
}
}
I am navy to Yii2 . Please somebody help me to resolve the error.