39 lines
927 B
PHP
39 lines
927 B
PHP
<?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;
|
||
}
|
||
}
|
||
}
|