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

search for in the

Weakref> <Esempi
[edit] Last updated: Tue, 21 May 2013

view this page in

Esempio che mostra l'effetto di scream

Questo esempio mostra come scream influisce sul comportamento del gestore di errori di PHP.

Example #1 Abilitazione e disabilitazione di scream in fase di runtime

<?php
// Si assicura che vengano visualizzati gli errori
ini_set('display_errors'true);
error_reporting(E_ALL);

// Disabilito scream - questo è il valore predefinito e produce un errore
ini_set('scream.enabled'false);
echo 
"Opening http://example.com/not-existing-file\n";
@
fopen('http://example.com/not-existing-file''r');

// Ora abilito scream e riprovo
ini_set('scream.enabled'true);
echo 
"Opening http://example.com/not-existing-file\n";
@
fopen('http://example.com/another-not-existing-file''r');
?>

Il precedente esempio visualizzerà qualcosa simile a:

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

Nota: Di solito si dovrebbe impostare questo valore nel file di configurazione php.ini invece di cambiare il codice.



add a note add a note User Contributed Notes Esempio che mostra l'effetto di scream - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites