包含文件内容php

Rub*_*ben 0 php file include

我想将php文件中的内容包含到另一个php文件中.(它在wordpress网站中)
包含或要求不起作用,因为它只包括文件,我需要内容本身.
file_get_contents也无法正常工作,因为它只显示我的php代码而不执行它.

我必须使用什么功能?

Rij*_*ijk 5

我也不完全理解你的问题,但我认为这可能对你有用:

ob_start();
include('yourfile.php');
$contents = ob_get_clean();
Run Code Online (Sandbox Code Playgroud)

$contents 现在将包含PHP脚本的"内容"(输出).