función de PHP highlight_string ()
PHP Manual de Referencia Miscelánea
Ejemplos
La cadena de resaltado de sintaxis PHP:
<html>
<body>
<?php
highlight_string("Hello world! <?php phpinfo(); ?>");
?>
</body>
</html>
<body>
<?php
highlight_string("Hello world! <?php phpinfo(); ?>");
?>
</body>
</html>
Salida en el navegador del código anterior es el siguiente:
Hello world! <?php phpinfo (); ?>
salida HTML del código anterior es el siguiente (ver fuente):
<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>
Instancia en ejecución »
Definición y Uso
highlight_string (cuerdas) de función para destacar la sintaxis de PHP. Cadena utilizando etiquetas HTML resaltado.
El color utilizado para resaltar el archivo php.ini se puede ajustar o llamando ini_set conjunto de funciones ().
gramática
highlight_string( string,return )
参数 | 描述 |
---|---|
string | 必需。规定要高亮显示的字符串。 |
return | 可选。如果该参数设置为 TRUE,该函数将以字符串形式返回高亮显示的代码,而不是直接进行输出。默认是 FALSE。 |
detalles técnicos
Devuelve: | Si tiene éxito, devuelve TRUE, en caso de error devuelve FALSO. |
---|---|
versión de PHP: | 4+ |
registro de actualización: | Agregado en PHP 4.2.0 El parámetro de retorno. |
PHP Manual de Referencia Miscelánea