(Yaf >=1.0.0)
Yaf_Application::execute — Execute a callback
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.
callbackA valid callback to execute.
argsOptional parameters passed to the callback.
Returns whatever the callback returns, or false if calling the
callback failed.
Example #1 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"
}