mirror of
https://github.com/php/doc-ja.git
synced 2026-03-25 07:32:13 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@329091 c90b9560-bf6c-de11-be94-00142212c4b1
129 lines
3.9 KiB
XML
129 lines
3.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: f9a6276cf26fbb9dddb80648c770032c01bf2329 Maintainer: hirokawa Status: ready -->
|
|
<!-- CREDITS: takagi -->
|
|
<refentry xml:id="function.trigger-error" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>trigger_error</refname>
|
|
<refpurpose>ユーザーレベルのエラー/警告/通知メッセージを生成する</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>
|
|
ユーザーエラーを発生するために使用され、
|
|
組み込みのエラーハンドラまたは新しいエラーハンドラ
|
|
(<function>set_error_handler</function>)
|
|
として設定済みのユーザー定義関数と組み合わせて使用されます。
|
|
</para>
|
|
<para>
|
|
この関数は、実行時の例外に特定の応答を生成する必要がある場合に便利です。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>error_msg</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
このエラーに割り当てられたメッセージ。長さは最大 1024 バイトまでです。
|
|
1024 バイトを超える部分は切り捨てられます。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>error_type</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
このエラーに割り当てられたエラー型。E_USER 関連の定数のみが指定可能で、
|
|
デフォルトは <constant>E_USER_NOTICE</constant> です。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
この関数は、間違った <parameter>error_type</parameter> が指定された場合に
|
|
&false; を、それ以外の場合に &true; を返します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>trigger_error</function> の例</title>
|
|
<para>
|
|
より拡張した例については <function>set_error_handler</function>
|
|
を参照ください。
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
if ($divisor == 0) {
|
|
trigger_error("ゼロで割ることはできません", E_USER_ERROR);
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<warning>
|
|
<para>
|
|
<parameter>error_msg</parameter> の HTML エンティティはエスケープされません。
|
|
エラーをブラウザに表示するのなら、メッセージに対して
|
|
<function>htmlentities</function> を使ってください。
|
|
</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><link linkend="errorfunc.constants">エラーレベル定数</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
|
|
-->
|