PHP 8.6.0 Beta 3 is available for testing

Yaf_Exception::__construct

(Yaf >=1.0.0)

Yaf_Exception::__construct构造一个 Yaf 异常

说明

public function Yaf_Exception::__construct(string $message = "", int $code = 0)

构造一个新的 Yaf_Exceptioncode 携带用于标识失败类型的 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
添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top