php在filter_input()中使用变量 [英] php use a variable in filter_input()

查看:71
本文介绍了php在filter_input()中使用变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用一个变量来通过filter_input()来获取帖子
代码如下:

  for ($ i = ' '  $ childname  = " .$一世;
      打印 " ;
       $ ChildsName  = filter_input(INPUT_POST,'  $ childname');
      打印 " ; 


}
我确信,ChildsName1帖子将以Eliza的形式出现,但不会在上述打印声明中显示.它返回null.
第一张打印图显示$ childname应该是ChildsName1.

我不想重复代码10次....

谢谢,感谢您的帮助.
Hal

解决方案

i = ' 1';


i< = ' 10'; blockquote>

i ++) {


I am trying to use a variable to pickup posts with filter_input()
The code is as follows:

for ($i='1'; $i<='10'; $i++)
{
      $childname = "ChildsName".$i;
      print "childname = $childname<br />";
      $ChildsName = filter_input(INPUT_POST,'$childname');
      print "$i. $ChildsName<br />\n";


}
I am positive that the post ChildsName1 is coming through as Eliza but it does not show in the above print statements. It comes back null.
The first print shows $childname to be ChildsName1 as it should be.

I don''t want to have to repeat the code 10 times....

Thanks, your help is appreciated.
Hal

解决方案

i='1';


i<='10';


i++) {


这篇关于php在filter_input()中使用变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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