Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 22511 программистов и 1202 робота. Сейчас ищут 748 программистов ...
Приступая к работе

Example that shows the effect of scream

Вернуться к: Примеры

This example demonstrates how scream affects the behaviour of PHP's error handler.

Пример #1 Enabling and disabling scream at runtime

<?php
// Make sure errors will be shown
ini_set('display_errors'true);
error_reporting(E_ALL);

// Disable scream - this is the default and produce an error
ini_set('scream.enabled'false);
echo 
"Opening http://example.com/not-existing-file\n";
@
fopen('http://example.com/not-existing-file''r');

// Now enable scream and try again
ini_set('scream.enabled'true);
echo 
"Opening http://example.com/not-existing-file\n";
@
fopen('http://example.com/not-existing-file''r');
?>

Результатом выполнения данного примера будет что-то подобное:

Opening http://example.com/not-existing-file
Opening http://example.com/not-existing-file

Warning: fopen(http://example.com/not-existing-file): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in example.php on line 14

Замечание: Usually one would set this in the php.ini configuration file instead of changing the code.



Вернуться к: Примеры

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware