<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.splfileobject.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'splfileobject.fgetss.php',
    1 => 'SplFileObject::fgetss',
    2 => 'Gets line from file and strip HTML tags',
  ),
  'up' => 
  array (
    0 => 'class.splfileobject.php',
    1 => 'SplFileObject',
  ),
  'prev' => 
  array (
    0 => 'splfileobject.fgets.php',
    1 => 'SplFileObject::fgets',
  ),
  'next' => 
  array (
    0 => 'splfileobject.flock.php',
    1 => 'SplFileObject::flock',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/spl/splfileobject/fgetss.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="splfileobject.fgetss" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SplFileObject::fgetss</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.0, PHP 7)</p><p class="refpurpose"><span class="refname">SplFileObject::fgetss</span> &mdash; <span class="dc-title">Gets line from file and strip HTML tags</span></p>

 </div>

 <div id="splfileobject.fgetss-refsynopsisdiv">
   <div class="warning"><strong class="warning">警告</strong><p class="simpara">本函数已自 PHP 7.3.0
起<em>弃用</em>，自 PHP 8.0.0 起<em>移除</em>。强烈建议不要依赖本函数。</p></div>
 </div>

 <div class="refsect1 description" id="refsect1-splfileobject.fgetss-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>SplFileObject::fgetss</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$allowable_tags</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Identical to <span class="methodname"><a href="splfileobject.fgets.php" class="methodname">SplFileObject::fgets()</a></span>, except that
   <span class="methodname"><strong>SplFileObject::fgetss()</strong></span> attempts to strip any HTML and PHP tags from
   the text it reads.
   The function retains the parsing state from call to call, and as such is not
   equivalent to calling <span class="function"><a href="function.strip-tags.php" class="function">strip_tags()</a></span> on the return value of
   <span class="methodname"><a href="splfileobject.fgets.php" class="methodname">SplFileObject::fgets()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-splfileobject.fgetss-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">allowable_tags</code></dt>
     <dd>
      <p class="para">
       Optional parameter to specify tags which should not be stripped. 
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-splfileobject.fgetss-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a string containing the next line of the file with HTML and PHP
   code stripped, or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on error.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-splfileobject.fgetss-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="methodname"><strong>SplFileObject::fgetss()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$str </span><span style="color: #007700">= &lt;&lt;&lt;EOD<br /></span><span style="color: #DD0000">&lt;html&gt;&lt;body&gt;<br /> &lt;p&gt;Welcome! Today is the &lt;?php echo(date('jS')); ?&gt; of &lt;?= date('F'); ?&gt;.&lt;/p&gt;<br />&lt;/body&gt;&lt;/html&gt;<br />Text outside of the HTML block.<br /></span><span style="color: #007700">EOD;<br /></span><span style="color: #0000BB">file_put_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">"sample.php"</span><span style="color: #007700">, </span><span style="color: #0000BB">$str</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$file </span><span style="color: #007700">= new </span><span style="color: #0000BB">SplFileObject</span><span style="color: #007700">(</span><span style="color: #DD0000">"sample.php"</span><span style="color: #007700">);<br />while (!</span><span style="color: #0000BB">$file</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">eof</span><span style="color: #007700">()) {<br />    echo </span><span style="color: #0000BB">$file</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">fgetss</span><span style="color: #007700">();<br />}<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">Welcome! Today is the  of .

Text outside of the HTML block.</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-splfileobject.fgetss-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.fgetss.php" class="function" rel="rdfs-seeAlso">fgetss()</a> - 从文件指针中读取一行并过滤掉 HTML 标记</span></li>
    <li><span class="methodname"><a href="splfileobject.fgets.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::fgets()</a> - Gets line from file</span></li>
    <li><span class="methodname"><a href="splfileobject.fgetc.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::fgetc()</a> - Gets character from file</span></li>
    <li><span class="methodname"><a href="splfileobject.current.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::current()</a> - Retrieve current line of file</span></li>
    <li>The <a href="filters.string.php#filters.string.strip_tags" class="link">string.strip_tags</a> filter</li>
   </ul>
  </p>
 </div>


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