Echo an $_POST in PHP

醉酒当歌 提交于 2019-11-30 05:17:17

问题


How can I print a $_POST?

Example:

echo $_POST['data'];

This returns nothing...


回答1:


You can also wrap your code with <pre> tags to make your array prints out nicer instead of just 1 continuous line. A trick that was shown by a member on this site.

<pre>
<?php var_dump($_POST); ?>
</pre>



回答2:


Your code is correct.

You can use either:

var_dump($_POST);

or

print_r($_POST);

to print out the entire POST array for debugging.




回答3:


You can only show the values of keys that exist. array_keys() returns an array containing the keys that exist in the array. If there is no output for a key despite the fact that the key exists then the array may contain an empty value for that key.



来源:https://stackoverflow.com/questions/3002165/echo-an-post-in-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!