Yaf_Exception::__construct
(Yaf >=1.0.0)
Yaf_Exception::__construct — 构造一个 Yaf 异常
说明
构造一个新的 Yaf_Exception。code 携带用于标识失败类型的 Yaf 错误码,并通过 Exception::getCode() 获取。
参数
message
异常信息。
code
Yaf 错误码。
返回值
没有返回值。
示例
示例 #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
来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。
