Here is an example of how you can get the instance of Yaf_Application from somewhere in your application.
index.php:
<?php
// Set BASE_PATH to one directory up, outside of document root
define('BASE_PATH', realpath(dirname(__FILE__) . '/..'));
// Instantiate new application
$app = new Yaf_Application(BASE_PATH . '/application/config/application.ini');
$app->bootstrap()->run();
?>
Blog.php (controller):
<?php
$app = Yaf_Application::app();
print_r($app);
?>
Yaf_Dispatcher::getApplication
(Yaf >=1.0.0)
Yaf_Dispatcher::getApplication — Récupère l'application
Description
Récupère l'instance Yaf_Application. Identique à la méthode Yaf_Application::app().
Liste de paramètres
Cette fonction ne contient aucun paramètre.
Valeurs de retour
Voir aussi
- Yaf_Application::app() - Récupère une instance de l'application
brandon at brandonlamb dot com ¶
1 year ago
