更新核心类库

This commit is contained in:
thinkphp
2015-01-17 22:26:14 +08:00
parent 223760b65d
commit 5a8e9fffde
41 changed files with 614 additions and 387 deletions

View File

@@ -130,9 +130,13 @@ class Loader {
* @return Object
*/
static public function model($name = '', $layer = 'Model') {
if(empty($name)) return new Model;
if(empty($name)) {
return new Model;
}
static $_model = [];
if(isset($_model[$name . $layer])) return $_model[$name . $layer];
if(isset($_model[$name . $layer])) {
return $_model[$name . $layer];
}
if(strpos($name, '/')) {
list($module, $name) = explode('/', $name);
}else{
@@ -157,7 +161,9 @@ class Loader {
*/
static public function controller($name, $layer = 'Controller') {
static $_instance = [];
if(isset($_instance[$name.$layer])) return $_instance[$name . $layer];
if(isset($_instance[$name.$layer])) {
return $_instance[$name . $layer];
}
if(strpos($name, '/')) {
list($module,$name) = explode('/', $name);
}else{
@@ -226,7 +232,7 @@ class Loader {
$_instance[$identify] = $o;
}
else
E('_CLASS_NOT_EXIST_:' . $class);
throw new Exception('_CLASS_NOT_EXIST_:' . $class);
}
return $_instance[$identify];
}