<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.yaf-exception.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'yaf-exception.construct.php',
    1 => 'Yaf_Exception::__construct',
    2 => '构造一个 Yaf 异常',
  ),
  'up' => 
  array (
    0 => 'class.yaf-exception.php',
    1 => 'Yaf_Exception',
  ),
  'prev' => 
  array (
    0 => 'class.yaf-exception.php',
    1 => 'Yaf_Exception',
  ),
  'next' => 
  array (
    0 => 'yaf-exception.getprevious.php',
    1 => 'Yaf_Exception::getPrevious',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/yaf/yaf_exception/construct.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="yaf-exception.construct" class="refentry">
 <div class="refnamediv">
<h1 class="refname">Yaf_Exception::__construct</h1>
<p class="verinfo">(Yaf &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">Yaf_Exception::__construct</span> &mdash; <span class="dc-title">构造一个 Yaf 异常</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-yaf-exception.construct-description">
  <h3 class="title">说明</h3>
  <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">function</span> <span class="methodname"><strong>Yaf_Exception::__construct</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$message</code><span class="initializer"> = &quot;&quot;</span></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$code</code><span class="initializer"> = 0</span></span>)</div>

  <p class="simpara">构造一个新的 <span class="exceptionname"><a href="class.yaf-exception.php" class="exceptionname">Yaf_Exception</a></span>。<code class="parameter">code</code> 携带用于标识失败类型的 Yaf 错误码，并通过 <span class="methodname"><a href="exception.getcode.php" class="methodname">Exception::getCode()</a></span> 获取。</p>
 </div>


 <div class="refsect1 parameters" id="refsect1-yaf-exception.construct-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">message</code></dt>
    <dd>
<p class="simpara">异常信息。</p>
    </dd>
   
   
    <dt><code class="parameter">code</code></dt>
    <dd>
<p class="simpara">Yaf 错误码。</p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-yaf-exception.construct-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="simpara">没有返回值。</p>
 </div>

 <div class="refsect1 examples" id="refsect1-yaf-exception.construct-examples">
  <h3 class="title">示例</h3>
  <div class="example" id="example-1">
   <p><strong>示例 #1 <span class="methodname"><strong>Yaf_Exception::__construct()</strong></span> 示例</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
</span><span style="color: #007700">throw new </span><span style="color: #0000BB">Yaf_Exception</span><span style="color: #007700">(
    </span><span style="color: #DD0000">"Failed to find the controller 'Product'"</span><span style="color: #007700">,
    </span><span style="color: #0000BB">YAF_ERR_NOTFOUND_CONTROLLER </span><span style="color: #FF8000">/* 516 */
</span><span style="color: #007700">);
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
   </div>

   <div class="example-contents"><p>以上示例的输出类似于：</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">PHP Fatal error:  Uncaught Yaf_Exception: Failed to find the controller &#039;Product&#039; in /path/to/index.php:2</pre>
</div>
   </div>
  </div>
 </div>



 <div class="refsect1 seealso" id="refsect1-yaf-exception.construct-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li><span class="exceptionname"><a href="class.yaf-exception.php" class="exceptionname">Yaf_Exception</a></span></li>
   <li><span class="methodname"><a href="yaf-exception.getprevious.php" class="methodname" rel="rdfs-seeAlso">Yaf_Exception::getPrevious()</a> - 获取前一个异常</span></li>
   <li><span class="classname"><a href="class.yaf-exception-routerfailed.php" class="classname">Yaf_Exception_RouterFailed</a></span></li>
  </ul>
 </div>


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