本文整理汇总了PHP中Bootstrap::app方法的典型用法代码示例。如果您正苦于以下问题:PHP Bootstrap::app方法的具体用法?PHP Bootstrap::app怎么用?PHP Bootstrap::app使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bootstrap
的用法示例。
在下文中一共展示了Bootstrap::app方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup_by_url
//.........这里部分代码省略.........
} else {
# /开头的后台URL
$admin_url[] = $admin_url;
}
}
}
if ($item['url']) {
if (!is_array($item['url'])) {
$item['url'] = array($item['url']);
}
foreach ($item['url'] as $url) {
if (($path_info = $get_path_info($url)) != false) {
self::$project = $project;
self::$path_info = $path_info;
self::$base_url = $url;
if ($admin_url) {
foreach ($admin_url as $url2) {
# 处理后台URL不是 http:// 或 https:// 开头的形式
if (($path_info_admin = $get_path_info($url2)) != false) {
self::$path_info = $path_info_admin;
self::$base_url .= ltrim($url2, '/');
$request_mode = 'admin';
break 3;
}
}
}
break 2;
}
}
}
}
}
if (self::$project) {
$project_dir = DIR_PROJECT . self::$project . DS;
if (!is_dir($project_dir)) {
self::show_error('not found the project: :project', array(':project' => self::$project));
}
# 根据URL寻找到了项目
self::$include_path = array_merge(array('\\project\\' . self::$project . '\\' => $project_dir), self::$include_path);
} else {
if (isset(self::$config['core']['url']['admin']) && self::$config['core']['url']['admin'] && ($path_info = $get_path_info(self::$config['core']['url']['admin'])) != false) {
self::$path_info = $path_info;
self::$base_url = self::$config['core']['url']['admin'];
$request_mode = 'admin';
} else {
if (isset(self::$config['core']['apps_url']) && is_array(self::$config['core']['apps_url']) && self::$config['core']['apps_url']) {
foreach (self::$config['core']['apps_url'] as $app => $urls) {
if (!$urls) {
continue;
}
if (!preg_match('#^[a-z0-9_]+//[a-z0-9]+$#i', $app)) {
continue;
}
if (!is_array($urls)) {
$urls = array($urls);
}
foreach ($urls as $url) {
if (($path_info = $get_path_info($url)) != false) {
self::$app = $app;
self::$path_info = $path_info;
self::$base_url = $url;
break 2;
}
}
}
}
if (null === self::$app) {
# 没有相关应用
if (isset(self::$config['core']['url']['apps']) && self::$config['core']['url']['apps']) {
if (($path_info = $get_path_info(self::$config['core']['url']['apps'])) != false) {
# 匹配到应用默认目录
$path_info = trim($path_info, '/');
self::$app = true;
if ($path_info) {
$path_info_arr = explode('/', $path_info);
if (count($path_info_arr) >= 2) {
$app = array_shift($path_info_arr) . '/' . array_shift($path_info_arr);
if (preg_match('#^[a-z0-9_]+//[a-z0-9]+$#i', $app)) {
$path_info = '/' . implode('/', $path_info_arr);
self::$app = $app;
}
}
}
self::$path_info = $path_info;
self::$base_url = self::$config['core']['url']['apps'];
$request_mode = 'app';
}
}
}
if (self::$app && true !== self::$app) {
# 已获取到APP
$app_dir = DIR_APPS . self::$app . DS;
if (!is_dir($app_dir)) {
self::show_error('can not found the app: :app', array(':app' => self::$app));
}
$request_mode = 'app';
}
}
}
}
示例2: initAll
public function initAll()
{
self::$app = $this;
$this->initApplication();
$this->initEventManager();
$this->initSession();
$this->initView();
$this->initRouters();
$this->initDb();
$this->initCache();
$this->initConfig();
$this->initCookie();
$this->initTransactions();
}
示例3: __construct
public function __construct(Bootstrap $bootstrap)
{
$this->app = $bootstrap->app();
}
示例4: dirname
<?php
$dirname = dirname(__FILE__);
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
require_once $dirname . '/helpers.php';
require_once $dirname . '/app/core/Loader.php';
require_once $dirname . '/app/libs/Smarty.class.php';
$basename = basename($dirname);
$autoloader = new Loader();
$autoloader->register();
$class = getclass();
Bootstrap::app($class);
function getclass()
{
$dirname = dirname(__FILE__);
$basename = basename($dirname);
return ucfirst($basename);
}