本文整理匯總了PHP中Test\Bootstrap::run方法的典型用法代碼示例。如果您正苦於以下問題:PHP Bootstrap::run方法的具體用法?PHP Bootstrap::run怎麽用?PHP Bootstrap::run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Test\Bootstrap
的用法示例。
在下文中一共展示了Bootstrap::run方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Bootstrap
<?php
/**
* 入口
*
* @author
* @copyright
*/
use Test\Bootstrap;
use Phalcon\Http\Response;
use Phalcon\DI\FactoryDefault;
try {
include __DIR__ . '/../Config/Define.php';
include SDK_DIR . '/SDK.php';
include APP_DIR . '/Bootstrap.php';
$application = new Bootstrap();
$application->run();
} catch (\Phalcon\Mvc\Dispatcher\Exception $e) {
FactoryDefault::getDefault()->get('logger')->notice($e->getMessage());
$response = new Response();
$response->setStatusCode(404, 'Not Found')->send();
} catch (\Exception $e) {
$message = 'Exception: ' . $e->getMessage();
FactoryDefault::getDefault()->get('logger')->error($message);
$response = new Response();
$response->setStatusCode(503, debugMode() ? $message : null)->send();
}
示例2: Bootstrap
* CLI 入口
*
* @author
* @copyright
*/
use Test\Bootstrap;
use Phalcon\Http\Response;
use Phalcon\DI\FactoryDefault;
set_time_limit(0);
try {
include __DIR__ . '/../Config/Define.php';
include SDK_DIR . '/SDK.php';
include APP_DIR . '/Bootstrap.php';
$application = new Bootstrap('CLI');
$arguments = array();
foreach ($argv as $k => $arg) {
if ($k == 1) {
$arguments['task'] = $arg;
} elseif ($k == 2) {
$arguments['action'] = $arg;
} elseif ($k >= 3) {
$arguments['params'][] = $arg;
}
}
define('CURRENT_TASK', isset($argv[1]) ? $argv[1] : null);
define('CURRENT_ACTION', isset($argv[2]) ? $argv[2] : null);
$application->run($arguments);
} catch (\Exception $e) {
echo "Exception: " . $e->getMessage() . PHP_EOL;
exit(-1);
}