implements Phalcon\Mvc\UrlInterface, Phalcon\Di\InjectionAwareInterface
This components helps in the generation of: URIs, URLs and Paths
//Generate a URL appending the URI to the base URI echo $url->get('products/edit/1'); //Generate a URL for a predefined route echo $url->get(array('for' => 'blog-post', 'title' => 'some-cool-stuff', 'year' => '2012'));
Sets the DependencyInjector container
Returns the DependencyInjector container
Sets a prefix for all the URIs to be generated
$url->setBaseUri('/invo/'); $url->setBaseUri('/invo/index.php/');
Sets a prefix for all static URLs generated
$url->setStaticBaseUri('/invo/');
Returns the prefix for all the generated urls. By default /
Returns the prefix for all the generated static urls. By default /
Sets a base path for all the generated paths
$url->setBasePath('/var/www/htdocs/');
Returns the base path
Generates a URL
//Generate a URL appending the URI to the base URI echo $url->get('products/edit/1'); //Generate a URL for a predefined route echo $url->get(array('for' => 'blog-post', 'title' => 'some-cool-stuff', 'year' => '2015')); // Generate a URL with GET arguments (/show/products?id=1&name=Carrots) echo $url->get('show/products', array('id' => 1, 'name' => 'Carrots')); // Generate an absolute URL by setting the third parameter as false. echo $url->get('https://phalconphp.com/', null, false);
Generates a URL for a static resource
// Generate a URL for a static resource echo $url->getStatic("img/logo.png"); // Generate a URL for a static predefined route echo $url->getStatic(array('for' => 'logo-cdn'));
Generates a local path
© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/latest/api/Phalcon_Mvc_Url.html