2017-08-31 55 views
2

如何在Silex應用中傳遞URL?如何在Silex中獲取路由參數中的URL

我定的規範是:

http://mysilex.app/http://anotherurl.com 

所以,我想用它在我的應用程序是這樣的:

$app->get('/{url}', function ($url) { 
    //do awesome things with $url(=http://anotherurl.com) 
    return $url; 
}); 

這有可能在Silex的?

+0

'HTTP:// anotherurl.com'需要URL編碼。 –

回答

0

設置.*模式爲url參數

$app->get('/{url}', function ($url) { 
    //do awesome things with $url(=http://anotherurl.com) 
    return $url; 
}) 
->assert('url', '.*'); 
相關問題