<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.errorfunc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.error-get-last.php',
    1 => 'error_get_last',
    2 => '获取最后发生的错误',
  ),
  'up' => 
  array (
    0 => 'ref.errorfunc.php',
    1 => '错误处理 函数',
  ),
  'prev' => 
  array (
    0 => 'function.error-clear-last.php',
    1 => 'error_clear_last',
  ),
  'next' => 
  array (
    0 => 'function.error-log.php',
    1 => 'error_log',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/errorfunc/functions/error-get-last.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.error-get-last" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">error_get_last</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">error_get_last</span> &mdash; <span class="dc-title">获取最后发生的错误</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.error-get-last-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>error_get_last</strong></span>(): <span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.array.php" class="type array">array</a></span></span></div>

  <p class="para rdfs-comment">
   获取关于最后一个发生的错误的信息。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.error-get-last-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.error-get-last-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回了一个关联数组，描述了最后错误的信息，以该错误的 &quot;type&quot;、
   &quot;message&quot;、&quot;file&quot; 和 &quot;line&quot; 为数组的键。
   如果该错误由 PHP 内置函数导致的，&quot;message&quot;会以该函数名开头。
   如果还没有错误则返回 <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.error-get-last-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 An <span class="function"><strong>error_get_last()</strong></span> 范例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">$a</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">error_get_last</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>以上示例的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Array
(
    [type] =&gt; 8
    [message] =&gt; Undefined variable: a
    [file] =&gt; C:\WWW\index.php
    [line] =&gt; 2
)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.error-get-last-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><a href="errorfunc.constants.php" class="link">Error 常量</a></li>
    <li><var class="varname"><a href="reserved.variables.phperrormsg.php" class="classname">$php_errormsg</a></var> 变量</li>
    <li><span class="function"><a href="function.error-clear-last.php" class="function" rel="rdfs-seeAlso">error_clear_last()</a> - 清除最近一次错误</span></li>
    <li><a href="errorfunc.configuration.php#ini.display-errors" class="link"><code class="parameter">display_errors</code> 指令</a></li>
    <li><a href="errorfunc.configuration.php#ini.html-errors" class="link"><code class="parameter">html_errors</code> 指令</a></li>
    <li><a href="errorfunc.configuration.php#ini.xmlrpc-errors" class="link"><code class="parameter">xmlrpc_errors</code> 指令</a></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>