如何在 apache php 5.0 中启用 PUT 方法
我在 htaccess 中有一个内容
Options FollowSymLinks
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule .* index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
如何添加以启用 PUT 方法? 谢谢
I have a content in htaccess
Options FollowSymLinks
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule .* index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
How do I add to enable PUT method?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是可能适合您的解决方案
首先,一个支持 HTTP 摘要身份验证的实用程序文件,该文件
可以位于目标目录(或常见的 PHP 包含
目录(如果您可以设置):下载并重命名 dauth.php
其次,在相关目录中放置以下PHP脚本:
下载并重命名put.php
第三,存储以下.htaccess文件在目标目录中,
将“/path-to-target-directory”替换为域相对路径
(例如,如果可以在 http://mydomain/x/y/z.html,
那么 /path-to-target-directory 将是 '/x/y'): download并重命名.htaccess
.htaccess
示例:有关详细信息,请参阅:这里
Here is the solution which may work for you
First, a utility file to support HTTP digest authentication, which
can be located in the target directory (or a common PHP include
directory if you can set one up): dowload and rename dauth.php
Second, in the directory concerned, place the following PHP script:
download and rename put.php
Third, store the following .htaccess file in the target directory,
replacing '/path-to-target-directory' with the domain-relative path
(e.g. if a target file can be read at http://mydomain/x/y/z.html,
then the /path-to-target-directory would be '/x/y'): download and rename .htaccess
.htaccess
example:For more info refer: Here
约定涉及传输要使用的底层方法(在 POST 请求中)的
X-HTTP-METHOD-OVERRIDE
标头。您可以在 php 应用程序中获取此请求标头来定义是否处理 PUT 请求。
Conventions talk about the
X-HTTP-METHOD-OVERRIDE
header that transports the underlying method to be used (in a POST request).You can get this request header in your php application to define whether or not you handle a PUT request.
无需执行任何操作即可使用 apache“启用”PUT 请求。
如果您的意思是您没有收到通过 PUT 请求发送的数据 - 您的代码中需要一些像这样的 php 代码:
因为 PUT 请求不会填充
$_POST
(显然,因为它不是POST 请求)。No action is required to "enable" PUT requests with apache.
if you mean that you don't receive the data sent with a PUT request - you need some php code like this in your code:
since a PUT request will not populate
$_POST
(obviously, since it's not a POST request).