<?
use think\Env;
use think\Cookie;
use think\Db;
// 应用公共文件
//获取目录
function getRoot($file){
$fileUrl=str_replace('\\','/',realpath(dirname($file).'/'))."/";
$genIndex=strpos($fileUrl,'/Application/');
if($genIndex>0){
$rootPath=substr($fileUrl,0,$genIndex).'/';//~/home/web/zdm_jsens_com/public_html
return $rootPath;
}
}
//获取路径
function getRootDirName(){
if(PHP_OS === 'WINNT'){//liunx
$env=new Env();
$root=$env->get('ROOT_PATH');
$arr = explode('/',rtrim($root,'/'));
}else{
$arr = explode('\\',rtrim($root,'\\'));
}
return $arr[count($arr)-1];
}
//获取目录列表
function getDir($dir) {
$dirArray[]=NULL;
if (false != ($handle = opendir ( $dir ))) {
$i=0;
while ( false !== ($file = readdir ( $handle ))
thinkphp开发80cms公共方法
最新推荐文章于 2022-01-05 14:02:23 发布