男女疯狂一边摸一边做羞羞视频|啊好深好硬快点用力别停动态图|亚洲一区无码中文字幕|特级无码毛片免费视频播放▽|久久狠狠躁免费观看|国内精品久久久久久网站

對 PUT 方法的支持

PHP 對部分客戶(hù)端具備的 HTTP PUT 方法提供了支持。PUT 請求比文件上傳要簡(jiǎn)單的多,它們一般的形式為:

PUT /path/filename.html HTTP/1.1

這通常意味著(zhù)遠程客戶(hù)端會(huì )將其中的 /path/filename.html 存儲到 web 目錄樹(shù)。讓 Apache 或者 PHP 自動(dòng)允許所有人覆蓋 web 目錄樹(shù)下的任何文件顯然是很不明智的。因此,要處理類(lèi)似的請求,必須先告訴 web 服務(wù)器需要用特定的 PHP 腳本來(lái)處理該請求。在 Apache 下,可以用 Script 選項來(lái)設置。它可以被放置到 Apache 配置文件中幾乎所有的位置。通常我們把它放置在 <Directory> 區域或者 <VirtualHost> 區域??梢杂萌缦乱恍衼?lái)完成該設置:

Script PUT /put.php

這將告訴 Apache 將所有對 URI 的 PUT 請求全部發(fā)送到 put.php 腳本,這些 URI 必須和 PUT 命令中的內容相匹配。當然,這是建立在 PHP 支持 .php 擴展名,并且 PHP 已經(jīng)在運行的假設之上。 The destination resource for all PUT requests to this script has to be the script itself, not a filename the uploaded file should have.

With PHP you would then do something like the following in your put.php. This would copy the contents of the uploaded file to the file myputfile.ext on the server. You would probably want to perform some checks and/or authenticate the user before performing this file copy.

示例 #1 保存 HTTP PUT 文件

<?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($putdata1024))
  
fwrite($fp$data);

/* Close the streams */
fclose($fp);
fclose($putdata);
?>

男女疯狂一边摸一边做羞羞视频|啊好深好硬快点用力别停动态图|亚洲一区无码中文字幕|特级无码毛片免费视频播放▽|久久狠狠躁免费观看|国内精品久久久久久网站