【发布时间】:2015-05-20 14:36:34
【问题描述】:
我有以下内容可以读取文件并分配给字符串:
$insert_html = file_get_contents('view.php');
view.php 文件本身看起来像:
<div>This is price of your item: <?php echo $price; ?></div>
但是,文件中的 PHP 并没有被执行。 eval() 和 include 都没有给我想要的东西。最好的方法是什么?
【问题讨论】:
-
(quoted:) "eval() 和 include 都不能完全满足我的需求" 那你还在寻找什么?
-
这正是我想要的@littleibex。但第二个答案对我有用!
-
@GuillermoPhillips 是的,我也认为第二个答案更合适。
-
你能改变你的view.php吗?
标签: php