función de PHP highlight_file ()
PHP Manual de Referencia Miscelánea
Ejemplos
archivo de prueba ( "test.php") fueron resaltado de sintaxis PHP:
<html>
<body>
<?php
highlight_file("test.php");
?>
</body>
</html>
<body>
<?php
highlight_file("test.php");
?>
</body>
</html>
Salida en el navegador del código anterior es el siguiente (en función del contenido del documento):
<html>
<body>
<?php
echo ( "test.php" );
?>
</body>
</html>
<body>
<?php
echo ( "test.php" );
?>
</body>
</html>
salida HTML del código anterior es el siguiente (ver fuente):
<html>
<body>
<code><span style="color: #000000">
<html>
<br /><body>
<br /><span style="color: #0000BB"><?php
<br /></span><span style="color: #007700">echo (</span><span style="color: #DD0000">"test.php"</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">?>
<br /></span></body>
<br /></html></span>
</code>
</body>
</html>
<body>
<code><span style="color: #000000">
<html>
<br /><body>
<br /><span style="color: #0000BB"><?php
<br /></span><span style="color: #007700">echo (</span><span style="color: #DD0000">"test.php"</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">?>
<br /></span></body>
<br /></html></span>
</code>
</body>
</html>
Instancia en ejecución »
Definición y Uso
highlight_file () la función del resaltado de sintaxis del archivo PHP. Sintaxis resaltada mediante el uso de etiquetas HTML.
Consejo: para el color de resalte se puede ajustar mediante el archivo php.ini o llamando al conjunto de funciones ini_set ().
Nota: Cuando se utiliza esta función, se mostrará el archivo completo, incluyendo contraseñas y otra información sensible!
gramática
highlight_file( filename,return )
参数 | 描述 |
---|---|
filename | 必需。规定要显示的文件。 |
return | 可选。如果该参数设置为 TRUE,该函数将以字符串形式返回高亮显示的代码,而不是直接进行输出。默认是 FALSE。 |
detalles técnicos
Devuelve: | Si el parámetro de retorno se establece en TRUE, la función devolverá una cadena de código en negrita, en lugar de directamente de salida. De lo contrario, si tiene éxito devuelve TRUE, en caso de error devuelve FALSO. |
---|---|
versión de PHP: | 4+ |
registro de actualización: | A partir de PHP 4.2.1 en adelante, esta función es ahora también se ve afectada por safe_mode y open_basedir afectada. Sin embargo, en PHP 5.4 se elimina en safe_mode. Agregado en PHP 4.2.0 El parámetro de retorno. |
PHP Manual de Referencia Miscelánea