1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-30 11:02:18 +02:00
Files
archived-doc-ja/reference/errorfunc/functions/error-reporting.xml
TAKAGI Masahiro 3831ca58b3 sync with en.
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@193346 c90b9560-bf6c-de11-be94-00142212c4b1
2005-08-13 23:57:46 +00:00

234 lines
6.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.5 $ -->
<!-- EN-Revision: 1.14 Maintainer: hirokawa Status: ready -->
<!-- CREDITS: takagi -->
<refentry id="function.error-reporting">
<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>int</type><parameter>level</parameter></methodparam>
</methodsynopsis>
<para>
<function>error_reporting</function> 関数は、
<link linkend="ini.error-reporting">error_reporting</link> ディレクティブを
実行時に設定します。PHP には多くのエラーレベルがあり、
この関数によりスクリプトの持続時間(実行時間)のレベルが設定されます。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>level</parameter></term>
<listitem>
<para>
新しい <link linkend="ini.error-reporting">error_reporting</link>
レベル。ビットマスクまたは名前つき定数のどちらかです。将来の
バージョンとの互換性を保証するために、名前つき定数の使用が
強く推奨されています。エラーレベルが追加されると、整数の幅は増加します。
そのため、以前の整数を使用するエラーレベルは常に期待通りに動作するとは
限りません。
</para>
<para>
利用可能なエラーレベル定数の一覧を以下に示します。
これらのエラーの実際の意味は、
<link linkend="errorfunc.constants">定義済みの定数</link>
記述されています。
<table>
<title><function>error_reporting</function> レベル定数とビット値</title>
<tgroup cols="2">
<thead>
<row>
<entry></entry>
<entry>定数</entry>
</row>
</thead>
<tbody>
<row>
<entry>1</entry>
<entry>
<link linkend="e-error">E_ERROR</link>
</entry>
</row>
<row>
<entry>2</entry>
<entry>
<link linkend="e-warning">E_WARNING</link>
</entry>
</row>
<row>
<entry>4</entry>
<entry>
<link linkend="e-parse">E_PARSE</link>
</entry>
</row>
<row>
<entry>8</entry>
<entry>
<link linkend="e-notice">E_NOTICE</link>
</entry>
</row>
<row>
<entry>16</entry>
<entry>
<link linkend="e-core-error">E_CORE_ERROR</link>
</entry>
</row>
<row>
<entry>32</entry>
<entry>
<link linkend="e-core-warning">E_CORE_WARNING</link>
</entry>
</row>
<row>
<entry>64</entry>
<entry>
<link linkend="e-compile-error">E_COMPILE_ERROR</link>
</entry>
</row>
<row>
<entry>128</entry>
<entry>
<link linkend="e-compile-warning">E_COMPILE_WARNING</link>
</entry>
</row>
<row>
<entry>256</entry>
<entry>
<link linkend="e-user-error">E_USER_ERROR</link>
</entry>
</row>
<row>
<entry>512</entry>
<entry>
<link linkend="e-user-warning">E_USER_WARNING</link>
</entry>
</row>
<row>
<entry>1024</entry>
<entry>
<link linkend="e-user-error">E_USER_NOTICE</link>
</entry>
</row>
<row>
<entry>2047</entry>
<entry>
<link linkend="e-all">E_ALL</link>
</entry>
</row>
<row>
<entry>2048</entry>
<entry>
<link linkend="e-strict">E_STRICT</link>
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
変更前の <link linkend="ini.error-reporting">error_reporting</link>
レベルを返します。
</para>
</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 以外の全てのエラーを表示する
// これは php.ini で設定されているデフォルト値
error_reporting(E_ALL ^ E_NOTICE);
// 全ての PHP エラーを表示する(ビット 63 は PHP 3 で利用される)
error_reporting(E_ALL);
// error_reporting(E_ALL); と同じ
ini_set('error_reporting', E_ALL);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<warning>
<simpara>
PHP &gt; 5.0.0 では、値 2048 を有する <constant>E_STRICT</constant>
が利用可能です。<constant>E_ALL</constant> には、エラーレベル
<constant>E_STRICT</constant> は含まれ<emphasis>ません</emphasis>
ほとんどの <constant>E_STRICT</constant> レベルのエラーはスクリプトの
コンパイル時に発生します。そのため、
<link linkend="ini.error-reporting">error_reporting</link>
<constant>E_STRICT</constant> を含むように設定されている環境では
これらのエラーを検出できません。
</simpara>
</warning>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="ini.display-errors">display_errors</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:"../../../../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
-->