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

search for in the

Weakref> <Ejemplos
[edit] Last updated: Fri, 07 Jun 2013

view this page in

Ejemplo que muestra el efecto de scream

Este ejemplo demuestra como scream afecta el comportamiento del controlador de errores de PHP.

Ejemplo #1 Activando y desactivando scream en tiempo de ejecución

<?php
// Asegurarse de mostrar todos los errores
ini_set('display_errors'true);
error_reporting(E_ALL);

// Desactivar scream - este es el valor por defecto y producirá un error
ini_set('scream.enabled'false);
echo 
"Abriendo http://example.com/not-existing-file\n";
@
fopen('http://example.com/not-existing-file''r');

// Ahora activamos scream y probamos de nuevo
ini_set('scream.enabled'true);
echo 
"Abriendo http://example.com/not-existing-file\n";
@
fopen('http://example.com/another-not-existing-file''r');
?>

El resultado del ejemplo sería algo similar 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: Normalmente se querrá activar esta directiva en el fichero de configuración php.ini en lugar de cambiar el código.



add a note add a note User Contributed Notes Ejemplo que muestra el efecto de scream - [0 notes]
There are no user contributed notes for this page.

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