Answer the question
In order to leave comments, you need to log in
Incomprehensible value when routing, how to find out where the error comes from?
here is the url
http://film.lc/serial/category/oneserial?id=serial-Bekstrom
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
[
'class' => 'frontend\components\FilmUrlRule',
],
],
class FilmUrlRule extends Object implements UrlRuleInterface
{
public function createUrl($manager, $route, $params)
{
var_dump($route);
var_dump($params);
}
public function parseRequest($manager, $request)
{ return false;
}
}
string(19) "serial/category/all" array(0) { }
Answer the question
In order to leave comments, you need to log in
1. Your parseRequest returns false, which is what you expect from this code.
2. Why did the class appear in the rules
3. Why did it become necessary to create a class and override the standard one, why not do what you want with standard methods?
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'serial/category/oneserial' => 'mySomeController/myaction'
],
],
public function actionMyaction($id){
echo $id;
}
'rules' => [
'<serial>/<category>/oneserial' => 'mySomeController/myaction'
],
public function actionMyaction($id,$serial,$category){
echo $id;
echo $serial;
echo $category;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question