2011-01-30 23 views

cevap

16
highlight_file('myFile.php'); 

veya PHPs dosya uzantısını değiştirmek

+0

Diğer sayfaları gösterebilir misiniz? – delive

+0

@delive - tabiki sadece istediğiniz dosya adını belirtin; Bir değişkene ayarla, –

+0

ne olursa olsun bu yöntem ilegal değil? – delive

7

&lt; (ve &gt; ile isteğe >) ile < tüm tekrarlarını değiştirin:

<pre> 
&lt;?php echo 'hello world'; ?&gt; 
</pre> 
0

Sen <pre> etiketi kullanabilirsiniz:

<pre>SOME HTML ENCODED PHP CODE</pre> 
13

Sadece metin başka parçası gibi:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head><title></title> 
</head> 
<body> 

<?php 

$code = '<?php 
echo "Hello, World!"; 
?>'; 

echo '<pre>' . htmlspecialchars($code) . '</pre>'; 

?> 

</body> 
</html> 

İsteğe bağlı PHP bir builtin function to generate syntax highlight sahiptir:

<?php 

$code = '<?php 
echo "Hello, World!"; 
?>'; 

highlight_string($code); 

?> 
İlgili konular