我在使用file_get_contents()在php中不工作,当我 像这样使用。文件名是index.php文件file_get_contents()在php不工作
<?php
$content = "hi";
$content = file_get_contents('index.php');
echo $content;
?>
我想它打印喜多于一个TYM ..但它打印只有一个 时间..为什么?请告诉我...
我在使用file_get_contents()在php中不工作,当我 像这样使用。文件名是index.php文件file_get_contents()在php不工作
<?php
$content = "hi";
$content = file_get_contents('index.php');
echo $content;
?>
我想它打印喜多于一个TYM ..但它打印只有一个 时间..为什么?请告诉我...
我想你在这里要做的是,首先给$content
一个值,然后加无论是在index.php
。
如果是这样的情况下,这样做:
<?php
$content = "hi";
$content .= file_get_contents('index.php');
echo $content;
?>
随着=
你重新定义一个变量,所以也无所谓它是什么了。
With .=
you add something to a variable。
第1步:检查路径&的访问权限。
从您的密码中,您的变量$ content被file_get_contents()
返回的结果覆盖。因此,你的回显是打印我们函数返回的结果。
p.s.该功能应该可以工作。阅读manual。
我想你’重新尝试在这里使用递归。如果你查看源代码,它可能说,
hi<?php
$content = "hi";
$content .= file_get_contents('index.php');
echo $content;
?>
的原因,它只能打印“喜”是因为你的浏览器不将<php
标签识别为有效的HTML所以忽略它。我的问题是你为什么要这么做?你想达到什么目的?
'index.php'包含什么? –