<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.reflectionclass.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'reflectionclass.setstaticpropertyvalue.php',
    1 => 'ReflectionClass::setStaticPropertyValue',
    2 => '设置 public static 属性的值',
  ),
  'up' => 
  array (
    0 => 'class.reflectionclass.php',
    1 => 'ReflectionClass',
  ),
  'prev' => 
  array (
    0 => 'reflectionclass.resetaslazyproxy.php',
    1 => 'ReflectionClass::resetAsLazyProxy',
  ),
  'next' => 
  array (
    0 => 'reflectionclass.tostring.php',
    1 => 'ReflectionClass::__toString',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/reflection/reflectionclass/setstaticpropertyvalue.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="reflectionclass.setstaticpropertyvalue" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ReflectionClass::setStaticPropertyValue</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.2, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ReflectionClass::setStaticPropertyValue</span> &mdash; <span class="dc-title">设置 public static 属性的值</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-reflectionclass.setstaticpropertyvalue-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>ReflectionClass::setStaticPropertyValue</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$name</code></span>, <span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <p class="simpara">
   设置 public 静态属性的值。如果属性是 private 或 protected，则方法会失败。
  </p>
  <p class="simpara">
   <span class="methodname"><a href="reflectionproperty.setvalue.php" class="methodname">ReflectionProperty::setValue()</a></span> 允许设置 public、private 和 protected 属性的值。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-reflectionclass.setstaticpropertyvalue-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">name</code></dt>
     <dd>
      <p class="para">
       属性的名称。
      </p>
     </dd>
    
    
     <dt><code class="parameter">value</code></dt>
     <dd>
      <p class="para">
       属性的值。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-reflectionclass.setstaticpropertyvalue-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-reflectionclass.setstaticpropertyvalue-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>7.4.0</td>
      <td>
       使用 <span class="methodname"><strong>ReflectionClass::setStaticPropertyValue()</strong></span> 设置 private 或 protected
       静态属性现在会导致致命错误。之前会抛出 <span class="classname"><a href="class.reflectionexception.php" class="classname">ReflectionException</a></span>。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-reflectionclass.setstaticpropertyvalue-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="reflectionclass.getstaticpropertyvalue.php" class="methodname" rel="rdfs-seeAlso">ReflectionClass::getStaticPropertyValue()</a> - 获取静态（static）属性的值</span></li>
    <li><span class="methodname"><a href="reflectionproperty.setvalue.php" class="methodname" rel="rdfs-seeAlso">ReflectionProperty::setValue()</a> - Set property value</span></li>
   </ul>
  </p>
 </div>


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