PHP Conference Ehime 2026

Yaf_Request_Abstract::setRequestUri

(Yaf >=2.1.0)

Yaf_Request_Abstract::setRequestUriSet the request URI

Beschreibung

public function 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.

Parameter-Liste

uri

The request URI to set.

Rückgabewerte

Returns the request object itself.

Beispiele

Beispiel #1 Yaf_Request_Abstract::setRequestUri() example

<?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());
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

string(19) "/product/view/id/17"

Siehe auch

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top