Why is the below code displaying the php code from msg.php?
$flag = file('msg.php');
$content = "";
foreach ($flag as $value) {
$content .= $value;
}
echo $content;
Is there a way I can stop it displaying the PHP code?
Why is the below code displaying the php code from msg.php?
$flag = file('msg.php');
$content = "";
foreach ($flag as $value) {
$content .= $value;
}
echo $content;
Is there a way I can stop it displaying the PHP code?
You're outputting it as text with echo and reading it with file, neither of which will execute any PHP. Your example can be replaced with:
require 'msg.php';
and everything will work properly.