2017-08-31 2 views
2

Wie kann ich eine URL in einer Silex-App übergeben?Wie bekomme ich eine URL in route parameter in Silex

Meine gegebene Spezifikation ist:

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

Also, ich möchte es so in meiner app verwenden:

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

Ist das möglich in Silex?

+0

'http: // anotherurl.com' muss URL-kodiert. –

Antwort

0

Set .* Muster für url Parameter

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