Php 自动加载(监督它)并手动获取类
我目前正在用php创建一个模块 下面是我的主类文件中包含的函数Php 自动加载(监督它)并手动获取类,php,class,Php,Class,我目前正在用php创建一个模块 下面是我的主类文件中包含的函数 ... $xmldebug = simplexml_load_file($response); $xml = new SimpleXMLElement($response); if (!$xml) throw new Exception(_("Registry return malformed XML")); $result_
...
$xmldebug = simplexml_load_file($response);
$xml = new SimpleXMLElement($response);
if (!$xml)
throw new Exception(_("Registry return malformed XML"));
$result_attributes = $xml->response->result->attributes();
$response_code = (string)$result_attributes["code"];
if ($response_code == RFC3730_RESULT_CODE::ERR_CMD_FAILED ||
$response_code == RFC3730_RESULT_CODE::ERR_CMD_FAILED_END_SESSION)
throw new Exception(_("Registry error"));
if ($response_code == RFC3730_RESULT_CODE::ERR_CMD_FAILED_END_SESSION ||
$response_code == RFC3730_RESULT_CODE::ERR_AUTH_END_SESSION ||
$response_code == RFC3730_RESULT_CODE::OK_END_SESSION ||
$response_code == RFC3730_RESULT_CODE::ERR_SESSION_LIMIT_EXCEEDED)
$this->IsConnected = false;
if ($response_code == RFC3730_RESULT_CODE::ERR_OBJECT_NOT_EXISTS)
throw new ObjectNotExistsException();
if ($response_code == RFC3730_RESULT_CODE::ERR_OBJECT_STATUS_PROHIBITS_OP)
throw new ProhibitedTransformException();
if ($response_code == RFC3730_RESULT_CODE::ERR_OBJECT_EXISTS)
throw new ObjectExistsException();
echo $response_code;
$ok_codes = array( RFC3730_RESULT_CODE::OK,
RFC3730_RESULT_CODE::OK_ACK_DEQUEUE,
RFC3730_RESULT_CODE::OK_END_SESSION,
RFC3730_RESULT_CODE::OK_NO_MESSAGES,
RFC3730_RESULT_CODE::OK_PENDING
);
$is_success = in_array($response_code, $ok_codes);
...
当我“localy”进行一些测试时,我将enum.RFC3730_RESULT_代码文件(包含RFC3730_RESULT_代码类)与其他文件放在同一目录中。
现在,我尝试在平台上获取该模块,我将该文件再次放在与我的主类相同的目录中,但我得到以下错误
Exception: Unable to load / locate class RFC3730_RESULT_CODE IN /xxxx/xxxx/xxxx/core/class.autoload.php(127)
class.autoload.php文件是加密的,所以我有没有办法监督它并使用RFC3730类?我已经手动将该文件包含在需要它的函数中。这解决了问题