我正在尝试使用PHP将一些图像文件上传到服务器,发送到PHP的URL类似于
file:///用户/ [用户] /库/Application%20Support/iPhone%20Simulator/7.0/Applications/ [会话ID] /Upload%20test.app/file.txt
我使用以下代码读取文件的内容:
$url = "someurl";
$file = fopen($url, "rb");
$filename = $id;
$newfile = fopen($filename, "wb");
echo "File path: ".$url."<br/>";
echo "File contents: <br/>";
echo file_get_contents($url);
但是file_get_contents();
什么也没返回,有什么提示吗?
您不能采用read
这种方式,但是您想在其中读取数据并local drive
编写full path
或relative path
获取文件内容,
hello this is file first line.
this is another line.
<?php
$url = "A:\wamp\www\demofile.txt";
echo file_get_contents($url);
?>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句