PHP文件()错误,参数无效 [英] PHP file() error, invalid argument
问题描述
pre $
<?php
$ strLines = file('// tardis / htdocs / apps /freespace/FreeSpace-Servers.txt');
。
。
。
?>
但在php-errors.log中,我得到这个:
[28-Aug-2013 16:31:30] PHP Warning:file(// tardis / htdocs / apps / freespace / FreeSpace-Servers.txt)[function.file ]:未能打开流:C:\程序文件(x86)中的无效参数\Apache软件基金会\Apache2.2\htdocs\apps\freespace\freespace.php第二行
txt文件绝对存在。任何想法还有什么无效的论点可能暗示?文档似乎没有暗示其他许多事情。或者,我应该以不同的方式来做这件事吗?我的目标是以一系列的方式读取文件。如果你使用的是UNC,那么地址应该是
file('\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 。文本');
您可能还需要检查您的PHP配置是否允许您打开远程文件。
I have what should be a fairly straightforward operation, which gives me an error that doesn't seem very helpful. The code is this:
<?php
$strLines = file('//tardis/htdocs/apps/freespace/FreeSpace-Servers.txt');
.
.
.
?>
But in php-errors.log, I get this:
[28-Aug-2013 16:31:30] PHP Warning: file(//tardis/htdocs/apps/freespace/FreeSpace-Servers.txt) [function.file]: failed to open stream: Invalid argument in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\apps\freespace\freespace.php on line 2
The txt file is definitely there. Any ideas what else an "Invalid argument" might suggest? The documentation doesn't seem to hint at much of anything else. Or, should I be doing this a different way? My goal is to read the file in as an array of things. All help is appreciated.
If you're using UNC, then the address should be
file('\\\\tardis\\htdocs\\apps\\freespace\\FreeSpace-Servers.txt');
You may also need to check that your PHP configuration allows you to open remote files.
这篇关于PHP文件()错误,参数无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!