Sending POST parameters with Postman doesn#39;t work, but sending GET parameters does(用 Postman 发送 POST 参数不起作用,但发送 GET 参数可以)
问题描述
我正在尝试使用 Chrome 扩展 Postman 测试一个简单的 PHP 页面.当我发送 URL 参数时,脚本工作正常(例如,变量在 $_REQUEST 参数中可用).当我将它们作为 x-www-form-urlencoded 参数发送时,$_REQUEST 参数仅包含 PHPSESSID.
I'm trying to test a simple PHP page using the Chrome extension Postman. When I send URL parameters, the script works fine (eg the variables are available in the $_REQUEST parameter). When I send them as x-www-form-urlencoded parameters, the $_REQUEST parameter only contains the PHPSESSID.
脚本:
<?php
var_export($_REQUEST);
?>
当我发送 URL 参数时,$_REQUEST 包括它们:
When I send URL parameters, $_REQUEST includes them:
但是当我将它们作为 POST 变量发送时,$_REQUEST 不包括它们:
But when I send them as POST variables, $_REQUEST doesn't include them:
我错过了什么?
推荐答案
我在 Postman 中将 url 设置为 http:// 但 Apache 重定向到 https:// 不知何故 POST 变量被丢弃了.
I was setting the url in Postman to be http:// but Apache was redirecting to https:// and somehow the POST variables were being dropped along the way.
我将其更改为 https:// 后,POST 变量工作正常.
After I changed it to https://, the POST variables worked properly.
另请参阅:https://stackoverflow.com/a/28461500/704803
这篇关于用 Postman 发送 POST 参数不起作用,但发送 GET 参数可以的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:用 Postman 发送 POST 参数不起作用,但发送 GET 参数可以
基础教程推荐
- 将变量从树枝传递给 js 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- Web 服务器如何处理请求? 2021-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- php中的PDF导出 2022-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- php中的foreach复选框POST 2021-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
