提交表单后如何打印所有 POST 结果?
我需要查看提交到服务器进行测试的所有 POST
结果。
我如何创建一个要提交的新文件的示例是什么,该文件将回显随该表单提交的所有字段?
它是动态的,因此某些字段的名称/ID 可能为 field1、field2、field3
等。
I need to see all of the POST
results that are submitted to the server for testing.
What would be an example of how I can create a new file to submit to that will echo out all of the fields which were submitted with that form?
It's dynamic, so some fields may have a name/ID of field1, field2, field3
, etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
所有值都存储在
$_POST
集合中,或者如果您想要更奇特、更易于阅读的内容,请使用 foreach 循环遍历
$_POST
集合并打印值。All the values are stored in the
$_POST
collectionor if you want something fancier that is easier to read use a foreach loop to loop through the
$_POST
collection and print the values.您可以尝试 var_dump:
You could try var_dump:
简单地:
Simply:
你的意思可能是这样的:
You may mean something like this:
您可以使用像这样简单的东西
这将使它更容易查看:
You could use something as simple as this
This would make it a bit more viewable:
你绝对可以使用
var_dump
,但你提到你是在前端开发。我相信您会知道这一点,但只是提醒一下,请使用 Firefox 的 Firebug或 Chrome 的/Internet Explorer 的开发人员工具并检查该帖子。帖子会经过听众,您也应该能够从那里进行检查。You can definitely use
var_dump
, but you mentioned you are in front-end development. I am sure you would know this, but just as a reminder, use Firefox's Firebug or Chrome's / Internet Explorer's developers tool and check for the post. Post goes through hearders, and you should be able to check it from there too.奖励:检查 debug_backtrace() 并将跟踪添加到您的调试中。
Bonus: Check debug_backtrace() too add tracing to your debugging.