Home >Backend Development >PHP Tutorial >php的file_get_contents的问题,很奇怪,不知道怎么解决!

php的file_get_contents的问题,很奇怪,不知道怎么解决!

WBOY
WBOYOriginal
2016-06-06 20:32:561045browse

在使用file_get_contents时,出现奇怪的问题。

如果使用如下代码,可以运行:

<code>$ff =  "c:\\mywww\\www.bin3d.cn\\temp_upload\\files\\xxxx.txt";
echo file_get_contents($ff);
</code>

但是,如果是下面的代码就出现错误信息:

<code>$file = "xxxx.txt";
$ff =  "c:\\mywww\\www.bin3d.cn\\temp_upload\\files\\".$file."";
echo file_get_contents($ff);
</code>

错误信息是:

<code>Warning:  
file_get_contents(c:\mywww\www.xxx.cn\temp_upload\files\xxxx.txt): 
failed to open stream: No such file or directory in.... 
</code>

请问是什么问题呢?好烦人啊

回复内容:

在使用file_get_contents时,出现奇怪的问题。

如果使用如下代码,可以运行:

<code>$ff =  "c:\\mywww\\www.bin3d.cn\\temp_upload\\files\\xxxx.txt";
echo file_get_contents($ff);
</code>

但是,如果是下面的代码就出现错误信息:

<code>$file = "xxxx.txt";
$ff =  "c:\\mywww\\www.bin3d.cn\\temp_upload\\files\\".$file."";
echo file_get_contents($ff);
</code>

错误信息是:

<code>Warning:  
file_get_contents(c:\mywww\www.xxx.cn\temp_upload\files\xxxx.txt): 
failed to open stream: No such file or directory in.... 
</code>

请问是什么问题呢?好烦人啊

<code>php</code><code>$file = "xxxx.txt";
$ff =  "c:\\mywww\\www.bin3d.cn\\temp_upload\\files\\".$file;
echo file_get_contents($ff);
</code>
Statement:
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