(Yaf >=1.0.0)
Yaf_Exception::__construct — 构造一个 Yaf 异常
构造一个新的 Yaf_Exception。code 携带用于标识失败类型的 Yaf 错误码,并通过 Exception::getCode() 获取。
message异常信息。
codeYaf 错误码。
没有返回值。
示例 #1 Yaf_Exception::__construct() 示例
<?php
throw new Yaf_Exception(
"Failed to find the controller 'Product'",
YAF_ERR_NOTFOUND_CONTROLLER /* 516 */
);
?>以上示例的输出类似于:
PHP Fatal error: Uncaught Yaf_Exception: Failed to find the controller 'Product' in /path/to/index.php:2