PHP Conference Ehime 2026

Yaf_Exception::__construct

(Yaf >=1.0.0)

Yaf_Exception::__constructConstruct a Yaf exception

Опис

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

Constructs a new Yaf_Exception. The code carries the Yaf error code that identifies the type of failure, and is exposed via Exception::getCode().

Параметри

message

The exception message.

code

The Yaf error code.

Значення, що повертаються

No value is returned.

Приклади

Приклад #1 Yaf_Exception::__construct() example

<?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

Прогляньте також

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top