获取php文件的内容

Jam*_*mes 0 php get file

如何从其他php文件中的一个php文件中获取所有当前代码?

就像,我们在a.php里面有一些函数的文件.

和文件b.php,我们希望从中获取所有代码(不运行任何函数)a.php并在请求时将其回显给浏览器.

喜欢 (内部b.php):

$content = get_all_file_text(a.php);
echo $content;
Run Code Online (Sandbox Code Playgroud)

谢谢.

ajr*_*eal 8

似乎每个人都喜欢file_get_contents,当你尝试将它输出到浏览器时,这是我的建议:

file_get_contents + highlight_string

http://php.net/manual/en/function.highlight-string.php