<?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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'splfileobject.fgetss.php',
    1 => 'SplFileObject::fgetss',
    2 => 'R&eacute;cup&egrave;re une ligne d\'un fichier et supprime les balises HTML',
  ),
  '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' => 'fr',
    '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">Récupère une ligne d&#039;un fichier et supprime les balises HTML</span></p>

 </div>

 <div id="splfileobject.fgetss-refsynopsisdiv">
   <div class="warning"><strong class="warning">Avertissement</strong><p class="simpara">
 Cette fonction est <em>OBSOLÈTE</em> à partir de PHP 7.3.0,
 et a été <em>SUPPRIMÉE</em> à partir de PHP 8.0.0.
 Dépendre de cette fonction est fortement déconseillé.
</p></div>
 </div>

 <div class="refsect1 description" id="refsect1-splfileobject.fgetss-description">
  <h3 class="title">Description</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">
   Identique à la méthode <span class="methodname"><a href="splfileobject.fgets.php" class="methodname">SplFileObject::fgets()</a></span>, sauf que la méthode
   <span class="methodname"><strong>SplFileObject::fgetss()</strong></span> tente de supprimer toutes
   les balises HTML et PHP du texte lu.
   La fonction conserve l&#039;état de l&#039;analyse d&#039;appel en appel, et ainsi n&#039;est
   pas équivalent à l&#039;appel de <span class="function"><a href="function.strip-tags.php" class="function">strip_tags()</a></span> sur la valeur de
   retour de <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">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">allowable_tags</code></dt>
     <dd>
      <p class="para">
       Paramètre optionnel pour spécifier les balises qui ne doivent
       pas être supprimées.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-splfileobject.fgetss-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne une <a href="language.types.string.php" class="link">chaîne de caractères</a> contenant la prochaine ligne du fichier
   dont les balises HTML et PHP ont été supprimées, ou <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>
   si une erreur survient.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-splfileobject.fgetss-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple avec <span class="methodname"><strong>SplFileObject::fgetss()</strong></span></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;Bienvenue ! Aujourdh'ui, nous sommes le &lt;?php echo(date('jS')); ?&gt; de &lt;?= date('F'); ?&gt;.&lt;/p&gt;<br />&lt;/body&gt;&lt;/html&gt;<br />Texte en dehors d'un bloc HTML.<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>Résultat de l&#039;exemple ci-dessus est similaire à :</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Bienvenue ! Aujourdh&#039;ui, nous sommes le  de .

Texte en dehors d&#039;un bloc HTML.</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-splfileobject.fgetss-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.fgetss.php" class="function" rel="rdfs-seeAlso">fgetss()</a> - Renvoie la ligne courante du fichier et &eacute;limine les balises HTML</span></li>
    <li><span class="methodname"><a href="splfileobject.fgets.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::fgets()</a> - R&eacute;cup&egrave;re une ligne d'un fichier</span></li>
    <li><span class="methodname"><a href="splfileobject.fgetc.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::fgetc()</a> - R&eacute;cup&egrave;re un caract&egrave;re depuis le fichier</span></li>
    <li><span class="methodname"><a href="splfileobject.current.php" class="methodname" rel="rdfs-seeAlso">SplFileObject::current()</a> - R&eacute;cup&egrave;re la ligne courante d'un fichier</span></li>
    <li>Le filtre <a href="filters.string.php#filters.string.strip_tags" class="link">string.strip_tags</a></li>
   </ul>
  </p>
 </div>


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