Files
OMS/app/taskmgr/shell/shell.php
2025-12-28 23:13:25 +08:00

64 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Copyright © ShopeX http://www.shopex.cn. All rights reserved.
* See LICENSE file for license details.
*/
// 定义根目录
define('__ROOT_DIR', dirname(__FILE__) . '/../');
/**
* 类库自动加载
*
* @param string $class_name
* @return boolean
*/
function __autoloadOMS($class_name) {
if (stripos($class_name, 'PhpAmqpLib') !== false) {
return __autoloadAmqpLib($class_name);
}
$pos = strpos($class_name, '_');
if ($pos) {
$owner = substr($class_name, 0, $pos);
$class_name = substr($class_name, $pos + 1);
$path = __ROOT_DIR . 'lib/' . str_replace('_', '/', $class_name) . '.php';
if (file_exists($path)) {
return require_once $path;
} else {
return false;
}
} else {
return false;
}
}
function __autoloadAmqpLib($class_name) {
$filename = __ROOT_DIR . 'lib/third/' . str_replace("\\", '/', $class_name) . '.php';
if (file_exists($filename)) {
return require_once $filename;
} else {
return false;
}
}
//注册类文件自动引用
if(function_exists('spl_autoload_register')){
spl_autoload_register('__autoloadOMS');
}else{
die('Can not register autoload function !!!');
}
//加载配置文件
require_once(__ROOT_DIR . 'config/config.php');