Example that shows the effect of scream

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

Example #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

Note: Usually one would set this in the php.ini configuration file instead of changing the code.

相关文章
php map creates a new map using keys that aren t in another mapphp set creates a new set using values that aren t in another setphp vector returns a representation that can be converted to jsonphp eventbuffer re enable calls that modify an event bufferphp imap 函数 returns all of the imap errors that have occurredphp oci8 函数 returns the next child statement resource from a parent statement resource that has oracle database 12c implicit result setsphp sodium 函数 verify that the ciphertext includes a valid tagphp sodium 函数 verify that the password is a valid password verification stringphp sqlite 函数 execute a query that does not prefetch and buffer all dataphp svn 函数 creates and returns a stream that will be used to replacephp 范例 example that implements inclued into an applicationphp intlcalendar tell whether a day is a weekday weekend or a day that has a transition between the twophp intlrulebasedbreakiterator get the status values from the break rules that determined the current break positionphp intltimezone get the number of ids in the equivalency group that includes the given idphp mongocursor advances the cursor to the next result and returns that resultphp mongodb bson dbpointer returns a representation that can be converted to jsonphp mongodb bson minkey returns a representation that can be converted to jsonphp ktaglib mpeg file returns an object that provides access to the audio propertiesphp 范例 example that shows the effect of screamphp solrquery returns the maximum number of query terms that will be included in any generated query
关注编程学问公众号