mirror of
https://github.com/php/doc-ja.git
synced 2026-03-24 07:02:08 +01:00
171 lines
5.5 KiB
XML
171 lines
5.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 9caac4c5cce859b4ae5d497972442fcfaa840d81 Maintainer: hirokawa Status: ready -->
|
|
<!-- CREDITS: takagi,mumumu -->
|
|
<refentry xml:id="function.error-reporting" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>error_reporting</refname>
|
|
<refpurpose>出力する PHP エラーの種類を設定する</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>error_reporting</methodname>
|
|
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>error_level</parameter><initializer>&null;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>error_reporting</function> 関数は、
|
|
<link linkend="ini.error-reporting">error_reporting</link> ディレクティブを
|
|
実行時に設定します。PHP には多くのエラーレベルがあり、
|
|
この関数によりスクリプトの持続時間(実行時間)のレベルが設定されます。
|
|
オプションの <parameter>error_level</parameter> を指定しなかった場合は、
|
|
<function>error_reporting</function> は単に現在のエラーレベルを返します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>error_level</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
新しい <link linkend="ini.error-reporting">error_reporting</link>
|
|
レベル。ビットマスクまたは名前つき定数のどちらかです。将来の
|
|
バージョンとの互換性を保証するために、名前つき定数の使用が
|
|
強く推奨されています。エラーレベルが追加されると、整数の幅は増加します。
|
|
そのため、以前の整数を使用するエラーレベルは常に期待通りに動作するとは
|
|
限りません。
|
|
</para>
|
|
<para>
|
|
利用可能なエラーレベル定数とその実際の意味は、
|
|
<link linkend="errorfunc.constants">定義済みの定数</link>に
|
|
記述されています。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
<parameter>error_level</parameter> に変更される <emphasis>前</emphasis> の、
|
|
<link linkend="ini.error-reporting">error_reporting</link> レベルを返します。
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
<link linkend="language.operators.errorcontrol">エラー制御演算子</link>
|
|
<literal>@</literal> は、エラーハンドリングの間に <parameter>error_level</parameter> を変更します。
|
|
</simpara>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.0.0</entry>
|
|
<entry>
|
|
<parameter>error_level</parameter> は、nullable になりました。
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>error_reporting</function> の例</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
// 全てのエラー出力をオフにする
|
|
error_reporting(0);
|
|
|
|
// 単純な実行時エラーを表示する
|
|
error_reporting(E_ERROR | E_WARNING | E_PARSE);
|
|
|
|
// E_NOTICE を表示させるのもおすすめ(初期化されていない
|
|
// 変数、変数名のスペルミスなど…)
|
|
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
|
|
|
|
// E_NOTICE 以外の全てのエラーを表示する
|
|
error_reporting(E_ALL & ~E_NOTICE);
|
|
|
|
// 全ての PHP エラーを表示する
|
|
error_reporting(E_ALL);
|
|
|
|
// 全ての PHP エラーを表示する
|
|
error_reporting(-1);
|
|
|
|
// error_reporting(E_ALL); と同じ
|
|
ini_set('error_reporting', E_ALL);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<tip>
|
|
<simpara>
|
|
値に <literal>-1</literal> を指定すると、仮に将来のバージョンの PHP
|
|
で新しいレベルと定数が追加されたとしてもすべてのエラーを表示するようになります。
|
|
<constant>E_ALL</constant> 定数も、これと同じ挙動になります。
|
|
</simpara>
|
|
</tip>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><link linkend="ini.display-errors">display_errors</link> ディレクティブ</member>
|
|
<member><link linkend="ini.html-errors">html_errors</link> ディレクティブ</member>
|
|
<member><link linkend="ini.xmlrpc-errors">xmlrpc_errors</link> ディレクティブ</member>
|
|
<member><link linkend="language.operators.errorcontrol">エラー制御演算子</link></member>
|
|
<member><function>ini_set</function></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
|
|
-->
|