Php Foreach 2 var$邮政
我有以下表格:Php Foreach 2 var$邮政,php,html,Php,Html,我有以下表格: 以及在.txt文件中打印数据的PHP代码: 结果是: i=值 电子邮件=值 通过=值 我不需要打印$\u POST['I']值 有什么想法吗?添加一个IF,该IF为i测试$variable,然后使用continue忽略循环的迭代 您还可以使用一个fwrite <?php $handle = fopen("data.txt", "a"); foreach($_POST as $variable => $value) { if ( $variable ==
以及在.txt文件中打印数据的PHP代码:
结果是:
i=值电子邮件=值
通过=值 我不需要打印
$\u POST['I']
值
有什么想法吗?添加一个IF,该IF为
i
测试$variable
,然后使用continue忽略循环的迭代代码>
您还可以使用一个fwrite
<?php
$handle = fopen("data.txt", "a");
foreach($_POST as $variable => $value) {
if ( $variable == 'i' ){
continue; // will stop this itereation and continue with the next
}
// make one write for all 4 bits of data.
fwrite($handle, "$variable = $value \r\n");
}
fwrite($handle, "\r\n");
fclose($handle);
是,添加一个IF测试i
,然后忽略该行。请不要只要求我们解决问题或为您编写解决方案。初学者是受欢迎的,但我们希望您在提问之前能够努力解决自己的问题。我们不为您编写代码,尽管我们非常愿意帮助您解决您编写的代码的问题。