downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

WinCache> <
Last updated: Fri, 13 Nov 2009

view this page in

scream の効果を示す例

この例は、scream で PHP のエラーハンドラの挙動を変更するものです。

例1 実行時における scream の有効化/無効化

<?php
// エラーが表示されるようにします
ini_set('display_errors'true);
error_reporting(E_ALL);

// scream を無効 (デフォルト) にしてエラーを発生させます
ini_set('scream.enabled'false);
echo 
"Opening http://example.com/not-existing-file\n";
@
fopen('http://example.com/not-existing-file''r');

// それでは scream を有効にしてもう一度
ini_set('scream.enabled'true);
echo 
"Opening http://example.com/not-existing-file\n";
@
fopen('http://example.com/another-not-existing-file''r');
?>

上の例の出力は、 たとえば以下のようになります。

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

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

注意: 通常は、コードの中で変更するのではなく php.ini 設定ファイル で設定します。



add a note add a note User Contributed Notes
scream の効果を示す例
There are no user contributed notes for this page.

WinCache> <
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites