My PageController looks like:
namespace app\controllers;
use app\models\Page;
use yii\base\Controller;
use yii\web\NotFoundHttpException;
class PageController extends Controller
{
public function actionIndex($slug){
var_dump($slug);exit;
}
}
And my urlManager looks like this:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'page/<slug>' => 'page/index',
]
],
When I hit a URL as http://localhost/myproject/page/about-us I get error:
Too few arguments to function app\controllers\PageController::actionIndex(), 0 passed and exactly 1 expected.
Am I missing something?
Instead of
use