本文整理汇总了PHP中Bootstrap::setup方法的典型用法代码示例。如果您正苦于以下问题:PHP Bootstrap::setup方法的具体用法?PHP Bootstrap::setup怎么用?PHP Bootstrap::setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bootstrap
的用法示例。
在下文中一共展示了Bootstrap::setup方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runApplication
/**
* @param string $url
* @param \Phalcon\DI\FactoryDefault $di
*/
private function runApplication($url, DI\FactoryDefault $di = null)
{
require_once dirname(__DIR__) . '/../fixtures/app/Bootstrap.php';
$config = (require dirname(__DIR__) . '/../fixtures/app/config/config.php');
$config = new \Phalcon\Config($config);
$bootstrap = new \Bootstrap($config);
if ($di != null) {
$bootstrap->setDi($di);
}
$bootstrap->setup()->run($url);
}
示例2: run
public static function run()
{
Bootstrap::setup();
$app = new App();
if (Util::has_request_param("action")) {
$api = new Api($app);
$api->apply();
} else {
define("FALLBACK", $app->get_fallback());
normalized_require_once("page");
}
}
示例3: setUp
public function setUp()
{
$_SERVER['HTTP_HOST'] = 'vegas.dev';
$_SERVER['REQUEST_URI'] = '/';
$this->di = DI::getDefault();
$modules = (new ModuleLoader())->dump(TESTS_ROOT_DIR . '/fixtures/app', TESTS_ROOT_DIR . '/fixtures/app/config/');
$app = new Application();
$app->registerModules($modules);
require_once TESTS_ROOT_DIR . '/fixtures/app/Bootstrap.php';
$config = (require TESTS_ROOT_DIR . '/fixtures/app/config/config.php');
$config = new \Phalcon\Config($config);
$bootstrap = new \Bootstrap($config);
$bootstrap->setup();
$this->bootstrap = $bootstrap;
}
示例4: php_uname
if (!isset($load[0])) {
return false;
}
if ($load[0] <= $max_load_avg) {
// 未超过负载,则跳出
return false;
}
$msg_tpl = "[%s] HOST:%s LOAD:%s ARGV/URI:%s\n";
$time = @date(DATE_RFC2822);
$host = php_uname('n');
$load = sprintf('%.2f', $load[0]);
if (php_sapi_name() == "cli" || empty($_SERVER['PHP_SELF'])) {
$argv_or_uri = implode(',', $argv);
} else {
$argv_or_uri = $_SERVER['REQUEST_URI'];
}
$msg = sprintf($msg_tpl, $time, $host, $load, $argv_or_uri);
if (@is_dir($dir_log)) {
@file_put_contents($dir_log . "php-server-overload.log", $msg, FILE_APPEND);
}
# exit with 500 page
header("HTTP/1.1 500 Internal Server Error");
header("Expires: " . gmdate("D, d M Y H:i:s", time() - 99999) . " GMT");
header("Cache-Control: private");
header("Pragma: no-cache");
exit(file_get_contents($dir_wwwroot . 'errors/server_overload.html'));
}
_load_protection();
include $dir_library . 'bootstrap.php';
Bootstrap::setup();
示例5: dirname
<?php
/**
* @author Sławomir Żytko <slawek@amsterdam-standard.pl>
* @copyright (c) 2014, Amsterdam Standard
*/
error_reporting(E_ALL);
define('APP_ROOT', dirname(dirname(__FILE__)));
try {
require APP_ROOT . '/../../vendor/autoload.php';
require APP_ROOT . '/app/Bootstrap.php';
$config = (require APP_ROOT . '/app/config/config.php');
$bootstrap = new \Bootstrap(new \Phalcon\Config($config));
echo $bootstrap->setup()->run($_SERVER['REQUEST_URI']);
} catch (\Exception $ex) {
echo $ex->getMessage();
echo $ex->getTraceAsString();
}
示例6: dirname
<?php
/**
* @author Sławomir Żytko <slawek@amsterdam-standard.pl>
* @copyright (c) 2014, Amsterdam Standard
*/
error_reporting(E_ALL);
define('APP_ROOT', dirname(dirname(__FILE__)));
require APP_ROOT . '/vendor/autoload.php';
require APP_ROOT . '/app/Bootstrap.php';
$config = (require APP_ROOT . '/app/config/config.php');
$bootstrap = new \Bootstrap(new \Phalcon\Config($config));
echo $bootstrap->setup()->run();
示例7: implode
$argv_or_uri = implode(',', $argv);
} else {
$argv_or_uri = $_SERVER['REQUEST_URI'];
}
$msg = sprintf($msg_tpl, $time, $host, $load, $argv_or_uri);
if (is_dir($dir_log) && is_writeable($dir_log . "php-server-overload.log")) {
@file_put_contents($dir_log . "php-server-overload.log", $msg, FILE_APPEND);
}
# exit with 500 page
header("HTTP/1.1 500 Internal Server Error");
header("Expires: " . gmdate("D, d M Y H:i:s", time() - 99999) . " GMT");
header("Cache-Control: private");
header("Pragma: no-cache");
exit(file_get_contents($dir_wwwroot . 'errors/server_overload.html'));
}
// 执行负载保护脚本
if ($max_load_avg > 0) {
_load_protection();
}
// 是否直接执行Core::run();
// 可在其它的文件中include此文件然后设置此变量
// 如果设置false则只初始化Bootstrap和Core类,不会执行Core::run();方法,通常用在shell文件里
if (!isset($auto_run)) {
// 默认直接执行
$auto_run = true;
} else {
$auto_run = (bool) $auto_run;
}
include dirname(__FILE__) . '/core/bootstrap.php';
Bootstrap::setup($auto_run);