library\App\View::url PHP Méthode

url() public méthode

Generates a fully qualified URL to the given path.
public url ( string $path = null ) : string
$path string
Résultat string
    public function url($path = null)
    {
        $app = Slim::getInstance();
        $components = array($app->request->getUrl());
        $scriptName = ltrim($app->request->getScriptName(), '/');
        if ($scriptName != '') {
            $components[] = $scriptName;
        }
        $path = ltrim($path, '/');
        if ($path != '') {
            $components[] = $path;
        }
        $url = implode('/', $components);
        return $url;
    }