PHP:可能自动获取所有发布的数据? [英] PHP: Possible to automatically get all POSTed data?

查看:98
本文介绍了PHP:可能自动获取所有发布的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简单的问题:即使你不知道所有的字段,是否有可能获得发布到页面的所有数据?

例如,我想要编写一个简单的脚本来收集任何POST数据并发送邮件。我可以预见,表单中的字段可能会随时间而发生很大的变化,为了长时间节省自己的时间,我想知道是否可以编写自动收集所有内容的东西?



是否有可能?

解决方案

当然。 $ _ $ POST 数组: $ key => $ value)
echoField.htmlspecialchars($ key)。is.htmlspecialchars($ value)。< br>;


Simple question: Is it possible to get all the data POSTed to a page, even if you don't know all the fields?

For example, I want to write a simple script that collects any POSTed data and emails it. I can foresee that the fields in the form are likely to change a lot over time, and so to save myself some time in the long run, I was wondering if I could write something that automatically gathered everything?

Is it possible?

解决方案

Sure. Just walk through the $_POST array:

foreach ($_POST as $key => $value)
 echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";

这篇关于PHP:可能自动获取所有发布的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆