本文介绍了var_dump($_POST);为空但不是 var_dump($_POST);死;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这个问题上找到了一些类似的主题,但对于我的情况没有:

i have found some similar topics on this issue, but nothing for my case:

我通过表单发送一些帖子数据,但 $_POST 数组始终为空(不为空).但是当我添加一个死;"或退出";后 var_dump($_POST);我可以看到所有发送的数据.

i send some post data via form, but the $_POST array is always empty (not null). but when i add a "die;" or "exit;" after var_dump($_POST); i can see all data sent.

也许需要知道,这是在onPreDispatch"上调用的(shopware)插件中.

maybe its relevant to know, that this is inside a (shopware) plugin which is called on "onPreDispatch".

感谢您的帮助

推荐答案

问题是重定向,虽然是在我读取请求中的参数之后重置了帖子.

the problem was the redirect, which resetted the post although it was after i read the parameters in the request.

我不知道,shopware 将所需的数据(paymentID)保存在数据库中.所以我将我的插件切换回onPostDispatch"(这样它会在所有其他操作之后被调用,其中一个将数据保存在 db 中).现在我可以读取数据库并获得相同的数据,这些数据最初位于 post 数组中.

i did not know, that shopware saves the desired data (paymentID) in the database. so i switched my plugin back to "onPostDispatch" (this way it will be called after all other actions, one of them saves the data in db). now i can just read the db and get the same data, which was initially in the post array.

我试图成为阅读帖子的第一个",但无法解决.现在我是最后一个阅读它的人,它运行良好.

i tried to be "the first" who reads the post, but could not work it out. now i am the last who reads it and it works fine.

感谢所有的回答!这里的线索是重定向".

thanks for all answers! the clue here was "redirect".

这篇关于var_dump($_POST);为空但不是 var_dump($_POST);死;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 09:29