<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.yaf.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'yaf.constants.php',
    1 => '预定义常量',
    2 => '预定义常量',
  ),
  'up' => 
  array (
    0 => 'book.yaf.php',
    1 => 'Yaf',
  ),
  'prev' => 
  array (
    0 => 'yaf.configuration.php',
    1 => '运行时配置',
  ),
  'next' => 
  array (
    0 => 'yaf.tutorials.php',
    1 => '示例',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/yaf/constants.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="yaf.constants" class="appendix">
 <h1 class="title">预定义常量</h1>

 <p class="simpara">下列常量由此扩展定义，且仅在此扩展编译入 PHP 或在运行时动态载入时可用。</p>
 <p class="simpara">
  当启动、路由、分发或自动加载过程中发生错误时，Yaf 要么抛出一个异常代码为 <code class="literal">YAF_ERR_*</code> 常量之一的 <span class="exceptionname"><a href="class.yaf-exception.php" class="exceptionname">Yaf_Exception</a></span> 子类，要么触发相应类型的 PHP 错误——参见 <span class="methodname"><a href="yaf-dispatcher.throwexception.php" class="methodname">Yaf_Dispatcher::throwException()</a></span> 和 <span class="methodname"><a href="yaf-application.getlasterrorno.php" class="methodname">Yaf_Application::getLastErrorNo()</a></span>。
 </p>
 <p class="para">
  <dl>
   
    <dt id="constant.yaf-version">
     <strong><code><a href="yaf.constants.php#constant.yaf-version">YAF_VERSION</a></code></strong>
     (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
    </dt>
    <dd>
     <p class="simpara">
      已加载的 Yaf 扩展的版本，例如 <code class="literal">&quot;3.3.8&quot;</code>。
     </p>
    </dd>
   
   
    <dt id="constant.yaf-environ">
     <strong><code><a href="yaf.constants.php#constant.yaf-environ">YAF_ENVIRON</a></code></strong>
     (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
    </dt>
    <dd>
     <p class="simpara">
      扩展启动时 <a href="yaf.configuration.php#ini.yaf.environ" class="link">yaf.environ</a> 指令的值，<span class="classname"><a href="class.yaf-application.php" class="classname">Yaf_Application</a></span> 用它来选择配置分节。默认值为 <code class="literal">&quot;product&quot;</code>。
     </p>
    </dd>
   
   
    <dt id="constant.yaf-err-startup-failed">
     <strong><code><a href="yaf.constants.php#constant.yaf-err-startup-failed">YAF_ERR_STARTUP_FAILED</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
    </dt>
    <dd>
     <p class="simpara">
      启动失败，值为 <code class="literal">512</code>。当 <span class="classname"><a href="class.yaf-application.php" class="classname">Yaf_Application</a></span> 无法启动时以 <span class="exceptionname"><a href="class.yaf-exception-startuperror.php" class="exceptionname">Yaf_Exception_StartupError</a></span> 抛出，例如应用目录缺失或配置无效。
     </p>
    </dd>
   
   
    <dt id="constant.yaf-err-route-failed">
     <strong><code><a href="yaf.constants.php#constant.yaf-err-route-failed">YAF_ERR_ROUTE_FAILED</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
    </dt>
    <dd>
     <p class="simpara">
      路由失败，值为 <code class="literal">513</code>。当没有任何路由能够处理该请求时以 <span class="classname"><a href="class.yaf-exception-routerfailed.php" class="classname">Yaf_Exception_RouterFailed</a></span> 抛出。
     </p>
    </dd>
   
   
    <dt id="constant.yaf-err-dispatch-failed">
     <strong><code><a href="yaf.constants.php#constant.yaf-err-dispatch-failed">YAF_ERR_DISPATCH_FAILED</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
    </dt>
    <dd>
     <p class="simpara">
      分发失败，值为 <code class="literal">514</code>。当请求无法被分发时以 <span class="classname"><a href="class.yaf-exception-dispatchfailed.php" class="classname">Yaf_Exception_DispatchFailed</a></span> 抛出，例如超出 <a href="yaf.configuration.php#ini.yaf.forward-limit" class="link">yaf.forward_limit</a>。
     </p>
    </dd>
   
   
    <dt id="constant.yaf-err-notfound-module">
     <strong><code><a href="yaf.constants.php#constant.yaf-err-notfound-module">YAF_ERR_NOTFOUND_MODULE</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
    </dt>
    <dd>
     <p class="simpara">
      找不到模块，值为 <code class="literal">515</code>。以 <span class="classname"><a href="class.yaf-exception-loadfailed-module.php" class="classname">Yaf_Exception_LoadFailed_Module</a></span> 抛出。
     </p>
    </dd>
   
   
    <dt id="constant.yaf-err-notfound-controller">
     <strong><code><a href="yaf.constants.php#constant.yaf-err-notfound-controller">YAF_ERR_NOTFOUND_CONTROLLER</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
    </dt>
    <dd>
     <p class="simpara">
      找不到控制器，值为 <code class="literal">516</code>。以 <span class="classname"><a href="class.yaf-exception-loadfailed-controller.php" class="classname">Yaf_Exception_LoadFailed_Controller</a></span> 抛出。
     </p>
    </dd>
   
   
    <dt id="constant.yaf-err-notfound-action">
     <strong><code><a href="yaf.constants.php#constant.yaf-err-notfound-action">YAF_ERR_NOTFOUND_ACTION</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
    </dt>
    <dd>
     <p class="simpara">
      找不到动作，值为 <code class="literal">517</code>。以 <span class="classname"><a href="class.yaf-exception-loadfailed-action.php" class="classname">Yaf_Exception_LoadFailed_Action</a></span> 抛出。
     </p>
    </dd>
   
   
    <dt id="constant.yaf-err-notfound-view">
     <strong><code><a href="yaf.constants.php#constant.yaf-err-notfound-view">YAF_ERR_NOTFOUND_VIEW</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
    </dt>
    <dd>
     <p class="simpara">
      找不到视图脚本，值为 <code class="literal">518</code>。以 <span class="classname"><a href="class.yaf-exception-loadfailed-view.php" class="classname">Yaf_Exception_LoadFailed_View</a></span> 抛出。
     </p>
    </dd>
   
   
    <dt id="constant.yaf-err-call-failed">
     <strong><code><a href="yaf.constants.php#constant.yaf-err-call-failed">YAF_ERR_CALL_FAILED</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
    </dt>
    <dd>
     <p class="simpara">
      调用方法失败，值为 <code class="literal">519</code>。当动作方法或其他可调用对象无法被调用时使用。
     </p>
    </dd>
   
   
    <dt id="constant.yaf-err-autoload-failed">
     <strong><code><a href="yaf.constants.php#constant.yaf-err-autoload-failed">YAF_ERR_AUTOLOAD_FAILED</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
    </dt>
    <dd>
     <p class="simpara">
      自动加载失败，值为 <code class="literal">520</code>。当类的文件无法被加载时由 <span class="classname"><a href="class.yaf-loader.php" class="classname">Yaf_Loader</a></span> 触发，例如解析出的路径过长。
     </p>
    </dd>
   
   
    <dt id="constant.yaf-err-type-error">
     <strong><code><a href="yaf.constants.php#constant.yaf-err-type-error">YAF_ERR_TYPE_ERROR</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
    </dt>
    <dd>
     <p class="simpara">
      发生类型错误，值为 <code class="literal">521</code>。当参数或类定义的类型不符合预期时以 <span class="exceptionname"><a href="class.yaf-exception-typeerror.php" class="exceptionname">Yaf_Exception_TypeError</a></span> 抛出，例如控制器不是一个继承自 <span class="classname"><a href="class.yaf-controller-abstract.php" class="classname">Yaf_Controller_Abstract</a></span> 的类。
     </p>
    </dd>
   
   
    <dt id="constant.yaf-err-access-error">
     <strong><code><a href="yaf.constants.php#constant.yaf-err-access-error">YAF_ERR_ACCESS_ERROR</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
    </dt>
    <dd>
     <p class="simpara">
      不允许访问，值为 <code class="literal">522</code>。例如尝试调用一个非 public 的动作方法时使用。
     </p>
     <p class="simpara">
      （自 Yaf 3.2.0 起可用。）
     </p>
    </dd>
   
  </dl>
 </p>
</div>
<?php manual_footer($setup); ?>