If I have two files a.php,b.php.
The statements in the a.php file are:
The code is as follows |
Copy Code |
<?php echo "I am a.php"; ?> |
Now, I need to display the source code in the file a.php in the b.php file, which is the source code, as follows:
The code is as follows |
Copy Code |
<?php $a _code = file_get_contents (' a.php '); Echo htmlspecialchars ($a _code);//www.111cn.net ?> |
The emphasis is on this htmlspecialchars () function, where the Htmlspecialchars () function converts some predefined characters into HTML entities.
Look at one more instance fopen () function
The code is as follows |
Copy Code |
$file = fopen ("a.php", "R"); |
The effect is the same as the above, of course, if we just want to display b.php in a.php, we can use INLUCDE () call directly
The code is as follows |
Copy Code |
INLUCDE (' a.php '); |
Can
If you want to read the. php file for the remote server, then the HTML content is returned, so don't ask why otherwise everyone will not write the program.