1
0
mirror of https://github.com/php/doc-es.git synced 2026-03-25 07:52:21 +01:00
Files
archived-doc-es/reference/scream/examples.xml
2013-12-16 18:48:46 +00:00

76 lines
2.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: a56106f69198dfe88c6084593c78a71c26b24353 Maintainer: yago Status: ready -->
<chapter xml:id="scream.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
<section xml:id="scream.examples-simple">
<title>Ejemplo que muestra el efecto de scream</title>
<para>
Este ejemplo demuestra como scream afecta el comportamiento del controlador de errores de PHP.
</para>
<para>
<example>
<title>Activando y desactivando scream en tiempo de ejecución</title>
<programlisting role="php">
<![CDATA[
<?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');
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Abriendo http://example.com/not-existing-file
Abriendo 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
]]>
</screen>
</example>
</para>
<note>
<simpara>
Normalmente se querrá activar esta directiva en el <link linkend="configuration.file">fichero de configuración php.ini</link>
en lugar de cambiar el código.
</simpara>
</note>
</section>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->