gpt4 book ai didi

Magento getPost 空数组

转载 作者:行者123 更新时间:2023-12-02 10:19:11 25 4
gpt4 key购买 nike

我有以下代码(请原谅错误的编码,就像调试一样):

$postData = Mage::app()->getRequest()->getPost();
if(!$postData)
{
$postData = $this->getRequest()->getPost();
}
if(!$postData)
{
$postData = $_POST;
}

如您所见,我只是想获取 HTTP POST 值。

这是场景:

  1. 数据来自 HTTP POST 模拟器
  2. 从 Shopify Webhook 中,没有任何结果(只有“Array()”)
  3. Shopify 发布到 PostCatcher 时显示大量数据

Shopify 以 JSON 格式发布。

关于我无法捕获 POST 数组有什么想法吗?

最佳答案

您无法仅使用 $_POSTMage::app()->getRequest()->getPost();JSON post 值。试试这个,

$value = json_decode(file_get_contents('php://input'));
print_r($value);

关于Magento getPost 空数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19801141/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com