我试图在解析后获取PHP文件的内容,然后将其存储在变量中.除了这个例子,我无法通过Google获得任何有用的信息:
ob_start();
include $file;
$content = ob_get_clean();
Run Code Online (Sandbox Code Playgroud)
但是这会将内容作为纯文本返回,即:<?php和?>标签仍然存在,标签之间的所有代码都不会被解析.
所以我想知道,我该怎么做呢?
更新: 这是包含的文件的内容:
Testcontent
<?php echo 'This should be parsed, right?'; ?>
Run Code Online (Sandbox Code Playgroud) php ×1