归档
This commit is contained in:
38
includes/lib/AppLoad.php
Normal file
38
includes/lib/AppLoad.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace lib;
|
||||
|
||||
class AppLoad {
|
||||
|
||||
/**
|
||||
* APP 模块加载
|
||||
*
|
||||
* @param string $name 文件默认index
|
||||
* @param string $dir 所在目录(最后请加/)
|
||||
* @return string|void
|
||||
*/
|
||||
static public function load($name = 'index',$dir=null){
|
||||
global $conf;
|
||||
$filename = ROOT.'app/'.$dir.$name;
|
||||
define("INDEX_ROOT",ROOT.'app/');
|
||||
define("STATIC_ROOT",ROOT.'assets/');
|
||||
if(file_exists($filename.'.php')) {
|
||||
return $filename.'.php';
|
||||
}else {
|
||||
http_response_code(404);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 【我也不知道这是干嘛的】(慎重删除)
|
||||
* @param $template
|
||||
* @return bool
|
||||
*/
|
||||
static public function exists($template){
|
||||
$filename = TEMPLATE_ROOT.$template.'/index.php';
|
||||
if(file_exists($filename)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user