指定Resource目录方式的改变
This commit is contained in:
parent
3db0e05509
commit
5b1aab990c
|
@ -31,13 +31,30 @@ class Framework {
|
||||||
|
|
||||||
defined('DEBUG') || define('DEBUG', false);
|
defined('DEBUG') || define('DEBUG', false);
|
||||||
|
|
||||||
|
self::setResourceDir();
|
||||||
|
|
||||||
require 'library/App.php';
|
require 'library/App.php';
|
||||||
App::start(self::$type, self::$defaultAddress);
|
App::start(self::$type, self::$defaultAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定Resource目录
|
||||||
|
* @param string $resourceDir
|
||||||
|
*/
|
||||||
|
public static function setResourceDir($resourceDir = '') {
|
||||||
|
if (!defined('RESOURCE')) {
|
||||||
|
if (!$resourceDir && isset($_SERVER['SCRIPT_NAME'])) {
|
||||||
|
$scriptName = $_SERVER['SCRIPT_NAME'];
|
||||||
|
$pos = strrpos($scriptName, '/');
|
||||||
|
$root = substr($scriptName, 0, $pos + 1);
|
||||||
|
$resourceDir = $root . 'resource/';
|
||||||
|
}
|
||||||
|
define('RESOURCE', $resourceDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 指定默认访问位置
|
* 指定默认访问位置
|
||||||
*
|
|
||||||
* @param string $address
|
* @param string $address
|
||||||
*/
|
*/
|
||||||
public static function setDefaultAddress($address) {
|
public static function setDefaultAddress($address) {
|
||||||
|
@ -46,7 +63,6 @@ class Framework {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 指定程序运行方式
|
* 指定程序运行方式
|
||||||
*
|
|
||||||
* @param int $type
|
* @param int $type
|
||||||
*/
|
*/
|
||||||
public static function setRunType($type) {
|
public static function setRunType($type) {
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use \top\Framework;
|
||||||
|
|
||||||
// 是否开启DEBUG模式
|
// 是否开启DEBUG模式
|
||||||
define('DEBUG', true);
|
define('DEBUG', true);
|
||||||
// APP目录
|
// APP目录
|
||||||
|
@ -8,4 +11,4 @@ define('FRAMEWORK_PATH', '../framework/');
|
||||||
// 加载框架
|
// 加载框架
|
||||||
require '../framework/Framework.php';
|
require '../framework/Framework.php';
|
||||||
|
|
||||||
\top\Framework::startApp();
|
Framework::startApp();
|
||||||
|
|
Loading…
Reference in New Issue