i have found some similar topics on this issue, but n开发者_运维问答othing for my case:
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.
maybe its relevant to know, that this is inside a (shopware) plugin which is called on "onPreDispatch".
thanks for any help
Your (shopware) plugin probably uses output buffering. Which means it will gather all the ecoes and prints until you call ob_flush() which prints all the buffer.
die() function, apart from everything else, also flushes the buffer when called. So, if you do ob_flush() after your echo you should get the needed result.
the problem was the redirect, which resetted the post although it was after i read the parameters in the request.
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".
精彩评论