<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.misc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.highlight-file.php',
    1 => 'highlight_file',
    2 => 'Colorisation syntaxique d\'un fichier',
  ),
  'up' => 
  array (
    0 => 'ref.misc.php',
    1 => 'Fonctions diverses',
  ),
  'prev' => 
  array (
    0 => 'function.halt-compiler.php',
    1 => '__halt_compiler',
  ),
  'next' => 
  array (
    0 => 'function.highlight-string.php',
    1 => 'highlight_string',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/misc/functions/highlight-file.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.highlight-file" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">highlight_file</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">highlight_file</span> &mdash; <span class="dc-title">Colorisation syntaxique d&#039;un fichier</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.highlight-file-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>highlight_file</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$return</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></span></div>

  <p class="para rdfs-comment">
   Affiche la syntaxe colorisée du fichier <code class="parameter">filename</code>,
   en utilisant les couleurs définies dans le moteur interne de PHP.
  </p>
  <p class="para">
   De nombreux serveurs sont configurés pour automatiquement
   afficher le source colorisé, avec l&#039;extension
   <em>phps</em>. Par exemple,
   <var class="filename">example.phps</var> va afficher le source du script.
   Pour activer cette fonctionnalité, utiliser cette ligne dans
   <var class="filename">httpd.conf</var> :
  </p>
  <div class="example-contents screen">
<div class="descriptioncode"><pre class="descriptioncode">AddType application/x-httpd-php-source .phps</pre>
</div>
  </div>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.highlight-file-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">filename</code></dt>
     <dd>
      <p class="para">
       Le chemin vers le fichier PHP à coloriser.
      </p>
     </dd>
    
    
     <dt><code class="parameter">return</code></dt>
     <dd>
      <p class="para">
       En passant ce paramètre à <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, la fonction
       retourne le code colorisé au lieu de l&#039;afficher.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.highlight-file-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Si le second paramètre optionnel <code class="parameter">return</code> vaut <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>
   alors <span class="function"><strong>highlight_file()</strong></span> retournera le code généré,
   au lieu de l&#039;afficher. Si le second paramètre ne vaut pas <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> alors
   <span class="function"><strong>highlight_file()</strong></span> retournera <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> en cas de succès, et
   <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> sinon.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.highlight-file-changelog">
  <h3 class="title">Historique</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>8.3.0</td>
       <td>
        Le HTML résultant a changé.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.highlight-file-notes">
  <h3 class="title">Notes</h3>
  <div class="caution"><strong class="caution">Attention</strong>
   <p class="para">
    Beaucoup de soin doit être apporté lors de l&#039;utilisation de
    <span class="function"><strong>highlight_file()</strong></span> pour s&#039;assurer que l&#039;on ne
    révèle pas d&#039;informations critiques telles que des mots de passe
    ou d&#039;autres informations qui pourraient créer des fuites d&#039;informations.
   </p>
  </div>
  <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para">
 Lorsque le paramètre <code class="parameter">return</code> est utilisé, cette fonction utilise la mise en tampon
 (buffer) interne de sortie, il ne peut donc pas être utilisé dans la fonction de rappel de <span class="function"><a href="function.ob-start.php" class="function">ob_start()</a></span>.
</p></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.highlight-file-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.highlight-string.php" class="function" rel="rdfs-seeAlso">highlight_string()</a> - Applique la syntaxe coloris&eacute;e &agrave; du code PHP</span></li>
    <li><a href="misc.configuration.php#ini.syntax-highlighting" class="link">Les directives INI de coloration</a></li>
   </ul>
  </p>
 </div>


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