Reputation: 195
i need to get a http address from my url in yii , but $url parameter returns wrong value for me
config:
'show/c/<id:\d+>/<url:\w+>'=>'show/c',
Controler :
public function actionC($id , $url)
{
echo $url ;
}
requested url :
http://localhost/mink/show/c/id/6/url/https://mail.google.com/mail/u/0/#inbox
$url value is "http:"
Edit : i found what was wrong with me , i have to use
http://localhost/mink/c/6/https://mail.google.com/mail/u/0/#inbox
and in url rule
'show/c/<id:\d+>/<url:.+>'=>'show/c',
it works now , ty
Upvotes: 2
Views: 532
Reputation: 8072
This will work
'show/c/<id:\d+>/url/<url:[\w.:\/]+>' => 'show/c',
You can use regular expressions syntax in rules.
Upvotes: 0
Reputation: 79093
You forgot to match a static "url" string before the url variable:
'show/c/<id:\d+>/url/<url:.+>'=>'show/c',
^^^ // Add this
You will also need to remove :\w+
from the regex:
'show/c/<id:\d+>/url/<url:.+>'=>'show/c',
^^^ // Remove this
This should be your final rule:
'show/c/<id:\d+>/url/<url>'=>'show/c',
Upvotes: 0
Reputation: 2414
Try this:
'show/c/<id:\d+>/<url:.+>'=>'show/c',
This should catch anything in URL, including slashes of course.
Upvotes: 2