mirror of
https://github.com/php/doc-es.git
synced 2026-03-24 15:32:36 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@331624 c90b9560-bf6c-de11-be94-00142212c4b1
130 lines
3.7 KiB
XML
130 lines
3.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 158026d7b2c41d8245b8a76130a74052e662056b Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="function.trigger-error" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>trigger_error</refname>
|
|
<refpurpose>Generar un mensaje de error/advertencia/aviso de nivel de usuario</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>trigger_error</methodname>
|
|
<methodparam><type>string</type><parameter>error_msg</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>error_type</parameter><initializer>E_USER_NOTICE</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Se usa para provocar una condición de error de usuario, se puede utilizar junto
|
|
con el gestor de errores interno o con una función definida por el usuario que ha
|
|
sido establecida como el nuevo gestor de errores
|
|
(<function>set_error_handler</function>).
|
|
</para>
|
|
<para>
|
|
Esta función es útil cuando se necesita generar una respuesta en particular a
|
|
una excepción en tiempo de ejecución.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>error_msg</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El mensaje de error designado para este error. Está limitado a 1024
|
|
bytes de longitud. Cualquier carácter más allá de los 1024 será
|
|
truncado.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>error_type</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El tipo de error designado para este error. Sólo funciona con la familia de constantes
|
|
E_USER, y por defecto es <constant>E_USER_NOTICE</constant>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Esta función devuelve &false; si se especifica un <parameter>error_type</parameter>
|
|
erróneo, si no &true;.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <function>trigger_error</function></title>
|
|
<para>
|
|
Véase <function>set_error_handler</function> para un ejemplo más extenso.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
if ($divisor == 0) {
|
|
trigger_error("No se puede dividir por cero", E_USER_ERROR);
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<warning>
|
|
<para>
|
|
Las entidades HTML en <parameter>error_msg</parameter> no son
|
|
escapadas. Use <function>htmlentities</function> en el mensaje si
|
|
el error se va a mostrar en un navegador.
|
|
</para>
|
|
</warning>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>error_reporting</function></member>
|
|
<member><function>set_error_handler</function></member>
|
|
<member><function>restore_error_handler</function></member>
|
|
<member>Las <link linkend="errorfunc.constants">constantes de niveles de error</link></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- 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
|
|
-->
|