Home > Backend Development > PHP Tutorial > 获取“包孕文件执行结果”的字符串

获取“包孕文件执行结果”的字符串

WBOY
Release: 2016-06-13 12:44:57
Original
840 people have browsed it

获取“包含文件执行结果”的字符串
为描述问题,下面给出一简单模型:
比如有一文件 a.php,内容如下:

<br />
<div id='top'><br />
    <?php $user="张三"; ?><br />
    <p>欢迎你:<?php print $user ?> <a href='../public/logout.php'>注销</a></p><br />
</div>
Copy after login


有另一文件 b.php
<br />
<?php<br />
$s=file_get_contents('a.php',1);<br />
?><br />
Copy after login


在 b.php 中虽然能读取文件 a.php 的内容,却不是执行后的内容,若希望能解释 php 中的代码,使 $s 得到如下的结果,有什么好的办法吗?
<br />
<div id='top'><br />
    <p>欢迎你:张三 <a href='../public/logout.php'>注销</a></p><br />
</div>
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template