PHP 8.4.26 Released!

Yaf_Application::setAppDirectory

(Yaf >=2.1.4)

Yaf_Application::setAppDirectory — Change the application directory

Beschreibung

public function Yaf_Application::setAppDirectory(string $directory): Yaf_Application|null|false

Change the application directory, under which Yaf looks for controllers, views and modules. The new directory must be an absolute path.

Parameter-Liste

directory

The absolute path of the new application directory.

Rückgabewerte

Returns the Yaf_Application object itself on success, false if directory is empty or not an absolute path, or null if the application is not properly initialized.

Beispiele

Beispiel #1 Yaf_Application::setAppDirectory() example

<?php
$app = Yaf_Application::app();

/* returns the application itself on success, for chaining */
var_dump($app->setAppDirectory("/srv/legacy/mvc/app"));
var_dump($app->getAppDirectory());

/* an empty or relative path is rejected */
var_dump($app->setAppDirectory(""));
var_dump($app->setAppDirectory("relative/path"));
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

object(Yaf_Application)#1 (0) {
}
string(20) "/srv/legacy/mvc/app"
bool(false)
bool(false)

Siehe auch

+add a note

User Contributed Notes

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