本文整理汇总了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);
}