Yaf_Request_Abstract::getBaseUri

(Yaf >=1.0.0)

Yaf_Request_Abstract::getBaseUriRetrieve the base URI

Description

public function Yaf_Request_Abstract::getBaseUri(): ?string

Retrieve the base URI

Parameters

This function has no parameters.

Return Values

The base URI, or an empty string if not set.

Examples

Example #1 Yaf_Request_Abstract::getBaseUri() example

<?php
class IndexController extends Yaf_Controller_Abstract
{
    public function indexAction()
    {
        $request = $this->getRequest();

        // Assuming the application is served under /myapp,
        // and the request is /myapp/product/view
        var_dump($request->getBaseUri());
        var_dump($request->getRequestUri());
    }
}
?>

The above example will output something similar to:

string(6) "/myapp"
string(19) "/myapp/product/view"

See Also

add a note

User Contributed Notes

There are no user contributed notes for this page.