我目前正在创建一个接收文件(图像)和其他一些数据的Web服务。
问题是PHP如何“处理”它?我读过一些文章说我应该使用PUT方法。你怎么看的? http://input? POST?文件?
答案 0 :(得分:2)
<?php
/* PUT data comes in on the stdin stream */
$putdata = fopen("php://input", "r");
/* Open a file for writing */
$fp = fopen("myputfile.ext", "w");
/* Read the data 1 KB at a time
and write to the file */
while ($data = fread($putdata, 1024))
fwrite($fp, $data);
/* Close the streams */
fclose($fp);
fclose($putdata);
?>