Yaf_Application::execute
(Yaf >=1.0.0)
Execute a callback
Description
Execute a callback. This method is typically used to run Yaf in a cron job or other CLI script, so that the script can reuse the autoloader and the bootstrap mechanism.
Parameters
callbackA valid callback to execute.
argsOptional parameters passed to the callback.
Return Values
Returns whatever the callback returns, or false if calling the callback failed.
Examples
Yaf_Application::execute() example
<?php
function main($argc, $argv) {
var_dump($argc);
var_dump($argv);
}
$config = array(
"application" => array(
"directory" => realpath(dirname(__FILE__)) . "/application",
),
);
/** Yaf_Application */
$application = new Yaf_Application($config);
$application->execute("main", $argc, $argv);
?>The above example will output something similar to:
int(2)
array(2) {
[0]=>
string(11) "execute.php"
[1]=>
string(3) "arg"
}See Also
Yaf_Application::bootstrap