Yaf_Request_Abstract::setRequestUri
PHP function
Edit on GitHub ✎
(Yaf >=2.1.0)
Set the request URI
Description
Yaf_Request_Abstract::setRequestUri(string $uri): Yaf_Request_Abstract
Set the request URI, overriding the one detected from the environment.
This is useful when dispatching manually, e.g. in tests, with a URI that differs from the real one.
Parameters
uriThe request URI to set.
Return Values
Returns the request object itself.
Examples
Yaf_Request_Abstract::setRequestUri example
php
<?php
$request = new Yaf_Request_Simple("CLI", "Index", "Index", "Index");
// Dispatch manually against a URI that differs from the real one
$request->setRequestUri("/product/view/id/17");
var_dump($request->getRequestUri());
?>The above example will output something similar to:
output
string(19) "/product/view/id/17"See Also
Yaf_Request_Abstract::getRequestUriYaf_Request_Abstract::setBaseUriYaf_Request_Abstract::getBaseUri