简体   繁体   中英

how to get a URL in route parameter in Silex

How can I pass a URL in a Silex-app?

My given specification is:

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

So, I would like to use it in my app like this:

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

Is that possible in Silex?

Set .* pattern for url parameter

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM