fonction highlight_string PHP ()
Exemples
La chaîne de PHP coloration syntaxique:
<html>
<body>
<?php
highlight_string("Hello world! <?php phpinfo(); ?>");
?>
</body>
</html>
<body>
<?php
highlight_string("Hello world! <?php phpinfo(); ?>");
?>
</body>
</html>
sortie du navigateur du code ci-dessus est la suivante:
Hello world! <?php phpinfo (); ?>
sortie HTML du code ci-dessus est la suivante (voir la source):
<html>
<body>
<code>
<span style="color: #000000">Hello world!
<span style="color: #0000BB"><?php phpinfo</span>
<span style="color: #007700">(); </span>
<span style="color: #0000BB">?></span>
</span>
</code>
</body>
</html>
<body>
<code>
<span style="color: #000000">Hello world!
<span style="color: #0000BB"><?php phpinfo</span>
<span style="color: #007700">(); </span>
<span style="color: #0000BB">?></span>
</span>
</code>
</body>
</html>
Exécution instance »
Définition et utilisation
highlight_string () des chaînes de fonctions syntaxe PHP de mise en surbrillance. Chaîne en utilisant des balises HTML en surbrillance.
Couleur utilisée pour mettre en évidence le fichier php.ini peut être réglé ou en appelant ini_set ensemble de fonctions ().
grammaire
highlight_string( string,return )
参数 | 描述 |
---|---|
string | 必需。规定要高亮显示的字符串。 |
return | 可选。如果该参数设置为 TRUE,该函数将以字符串形式返回高亮显示的代码,而不是直接进行输出。默认是 FALSE。 |
détails techniques
Retours: | En cas de succès, il retourne TRUE, en cas d'échec retourne FALSE. |
---|---|
PHP version: | 4+ |
Mise à jour de journal: | Ajouté en PHP 4.2.0 Le paramètre de retour. |
Manuel PHP Divers Référence