强制在入口文件调用Framework::appPath()指定应用目录
This commit is contained in:
parent
a0dd742016
commit
836a43ed0a
|
@ -22,7 +22,7 @@ class Framework
|
||||||
private static $defaultModule = 'home';
|
private static $defaultModule = 'home';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行
|
* 框架入口
|
||||||
* @param string $callable
|
* @param string $callable
|
||||||
*/
|
*/
|
||||||
public static function startApp($callable = '')
|
public static function startApp($callable = '')
|
||||||
|
@ -37,13 +37,32 @@ class Framework
|
||||||
date_default_timezone_set('PRC');
|
date_default_timezone_set('PRC');
|
||||||
|
|
||||||
self::debug();
|
self::debug();
|
||||||
self::appPath();
|
// 强制在入口文件指定应用目录
|
||||||
|
if (defined('APP_PATH')) {
|
||||||
|
// self::appPath();
|
||||||
self::appNameSpace();
|
self::appNameSpace();
|
||||||
self::resourcePath();
|
self::resourcePath();
|
||||||
self::frameworkPath();
|
self::frameworkPath();
|
||||||
|
|
||||||
require 'library/App.php';
|
require 'library/App.php';
|
||||||
App::start(self::$type, self::$defaultModule);
|
App::start(self::$type, self::$defaultModule);
|
||||||
|
} else {
|
||||||
|
echo '请使用Framework::appPath()指定应用目录';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用目录
|
||||||
|
* @param string $path
|
||||||
|
*/
|
||||||
|
public static function appPath($path = '')
|
||||||
|
{
|
||||||
|
if (!defined('APP_PATH')) {
|
||||||
|
if (!$path) {
|
||||||
|
$path = './application/';
|
||||||
|
}
|
||||||
|
define('APP_PATH', $path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,20 +90,6 @@ class Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用目录
|
|
||||||
* @param string $path
|
|
||||||
*/
|
|
||||||
public static function appPath($path = '')
|
|
||||||
{
|
|
||||||
if (!defined('APP_PATH')) {
|
|
||||||
if (!$path) {
|
|
||||||
$path = './application/';
|
|
||||||
}
|
|
||||||
define('APP_PATH', $path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function appNameSpace($namespace = '')
|
public static function appNameSpace($namespace = '')
|
||||||
{
|
{
|
||||||
if (!defined('APP_NS')) {
|
if (!defined('APP_NS')) {
|
||||||
|
|
Loading…
Reference in New Issue