Tuesday, January 29, 2013

How to display PHP code

In My Php File content display the html page use this code.

Create two files one is sample.php and another one is display.php

My file name : sample.php

Path : E:/xampp/htdocs

sample.php  (Content ):

<?php
  echo "test";
?>

Code :

This file name dispaly.php

<?php

$fname = $_SERVER['DOCUMENT_ROOT']."/sample.php";
echo "Php Code Display <br/>";
echo highlight_file($fname);

?>

 you run this url in your local server  http://localhost/dispaly.php

Output :


 Php Code Display


<?php
  echo "test";
?>


No comments:

Post a Comment