<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.fiber.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'fiber.throw.php',
    1 => 'Fiber::throw',
    2 => '用一个异常来恢复 fiber 的执行',
  ),
  'up' => 
  array (
    0 => 'class.fiber.php',
    1 => 'Fiber',
  ),
  'prev' => 
  array (
    0 => 'fiber.resume.php',
    1 => 'Fiber::resume',
  ),
  'next' => 
  array (
    0 => 'fiber.getreturn.php',
    1 => 'Fiber::getReturn',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'language/predefined/fiber/throw.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="fiber.throw" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Fiber::throw</h1>
  <p class="verinfo">(PHP 8 &gt;= 8.1.0)</p><p class="refpurpose"><span class="refname">Fiber::throw</span> &mdash; <span class="dc-title">用一个异常来恢复 fiber 的执行</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-fiber.throw-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><strong>Fiber::throw</strong></span>(<span class="methodparam"><span class="type"><a href="class.throwable.php" class="type Throwable">Throwable</a></span> <code class="parameter">$exception</code></span>): <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></div>

  <p class="para rdfs-comment">
   在当前调用 <span class="methodname"><a href="fiber.suspend.php" class="methodname">Fiber::suspend()</a></span> 的位置抛出指定的异常，恢复 fiber 执行。
  </p>
  <p class="para">
   如果调用此方法时 fiber 未挂起，将抛出 <span class="classname"><a href="class.fibererror.php" class="classname">FiberError</a></span>。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-fiber.throw-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">exception</code></dt>
    <dd>
     <p class="para">
      在当前调用 <span class="methodname"><a href="fiber.suspend.php" class="methodname">Fiber::suspend()</a></span> 所在的位置，要抛出的异常。
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-fiber.throw-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   下次调用 <span class="methodname"><a href="fiber.suspend.php" class="methodname">Fiber::suspend()</a></span> 所提供的值；如果 fiber 已返回，则是 <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>。
   如果 fiber 暂停前抛出一个异常，它将会从调用本方法的位置抛出。
  </p>
 </div>


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