Home Tutorial Php Examples show_source() example.

 
 

Share on Google+Share on Google+
show_source() example.
Posted on: July 30, 2009 at 12:00 AM
Advertisement
This is the example of show_source().

show_source()

The show_source() function works similar to highlight_file () which displays a file with the PHP syntax highlighted. The syntax is highlighted by using HTML tags. This function returns TRUE on success, or FALSE on failure.

Parameters

filename

Path to the PHP file to be highlighted.

return

Set this parameter to TRUE to make this function return the highlighted code

Syntax
show_source (filename, return)

Note: This function displays the entire file including passwords and any other sensitive information, so be cautious in using this function. 

Example: In the below example, we have used form action file for highlighting the source file.

<html>
<head>
</head>
<body>
<form action="<?php print $PHP_SELF ?>" method="get">

Enter file name:
<input type="text" name="file" value="<?php print $file; ?>">

<?php
if ( isset( $file ) )
show_source( $file ) or print "can not be open \"$file\"";
?>
</body>
</html>

Advertisement

Related Tags for show_source() example.:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 30, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com