脚本宝典收集整理的这篇文章主要介绍了如何在PHP中获取PUT / DELETE参数,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在接受如下输入,
$input = file_get_contents('PHP://input'); echo $input;
output = imei = 1234567890& email=hello@gmail1.COM
我怎样才能访问这些变量
echo $_POST['imei']; echo $_POST['email']; echo $_GET['imei']; echo $_GET['email'];
parse_str(file_get_contents("PHP://input"));
EX:
if($_SERVER['REQUEST_METHOD'] == 'GET') { echo "this is a get request\n"; echo $_GET['fruIT']." is the fruit\n"; echo "I want ".$_GET['quantity']." of them\n\n"; } elseif($_SERVER['REQUEST_METHOD'] == 'PUT') { echo "this is a put request\n"; parse_str(file_get_contents("PHP://input"),$post_VARs); echo $post_vars['fruit']." is the fruit\n"; echo "I want ".$post_vars['quantity']." of them\n\n"; }
参考:http://www.lornajane.net/posts/2008/accessing-incoming-put-data-from-php
以上是脚本宝典为你收集整理的如何在PHP中获取PUT / DELETE参数全部内容,希望文章能够帮你解决如何在PHP中获取PUT / DELETE参数所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。