代码很简单,大家注意看注释就可以了。
复制代码 代码如下:
/**
* 导入模块文件
*
* @param string $classString 导入文件路径字符串,可以用"."代替"/"
* @param string $fileType 导入文件类型的扩展名(带"."号),也可以是class/inc(简写方式)
* @return Exception 如果导入成功则返回true,否则返回异常对象
*
* @example
* importModule('gapi.Account') => include_once('modules/gapi/Account.class.php');
*/
function importModule($classString, $fileType = 'class')
{
$filename = $module_path. strtr($classString, '.', '/');
switch ($fileType) {
//导入类文件
case 'class': $filename .= '.class.php'; break;
//导入包含文件
case 'inc': $filename .= '.inc.php'; break;
//自定义导入文件的扩展名
default: $filename .= $fileType; break;
}
if (is_file($filename))
{
include_once($filename);
}
else
{
exit('class "\\' . strtr($classString, '.', '\\') . '" is not found.');
}
}
以上就是本文分享给大家的代码了,希望大家能够喜欢。
php,导入,模块文件
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
更新日志
- 王子异《1996 Part.2》[320K/MP3][18.29MB]
- 群星.1994-宝丽金最倾情3CD【宝丽金】【WAV+CUE】
- 乐俊亨.2024-同泪【CharioticMusic】【FLAC分轨】
- 何耀珊.2006-收获【华纳】【WAV+CUE】
- 梁汉文1994-壹精选[华星][WAV+CUE]
- 洪荣宏1981-歹路不可行·相思雨(飞跃复刻版)[光美][WAV+CUE]
- 旅行团2015-10Day’s[来福胶泥][WAV+CUE]
- 龙千玉.2011-卡将哟【豪记】【WAV+CUE】
- 蔣志光.1993-多情多寂寞(国专)【BMG】【WAV+CUE】
- 陈慧娴.1996-雪映美白96演唱会2CD(2024环球红馆40复刻系列)【环球】【WAV+CUE】
- 王子异《1996 Part.2》[FLAC/分轨][50.66MB]
- 贵族音乐《古典名曲与轻音乐钢琴 打开宝宝睡眠开关》[320K/MP3][155.91MB]
- 贵族音乐《古典名曲与轻音乐钢琴 打开宝宝睡眠开关》[FLAC/分轨][251.78MB]
- 黄韵玲2001-巴结音乐[全员集合][WAV+CUE]
- 郑绪岚2015-流金岁月·精选[首版][WAV+CUE]