Php CodeIgniter特定的输入后打印每次字符串;关于;
我有一个奇怪的问题。。。非常非常奇怪而且不可能!这是个陷阱!我的表单中有一些文本类型的输入,它们的名称类似于“name#0”,但当我使用$this->input->post(name#0)获得它时,每次打印(空输入或非空输入是相同的)字符串“on”。。。见鬼 代码如下:Php CodeIgniter特定的输入后打印每次字符串;关于;,php,codeigniter,post,Php,Codeigniter,Post,我有一个奇怪的问题。。。非常非常奇怪而且不可能!这是个陷阱!我的表单中有一些文本类型的输入,它们的名称类似于“name#0”,但当我使用$this->input->post(name#0)获得它时,每次打印(空输入或非空输入是相同的)字符串“on”。。。见鬼 代码如下: public function ColoredHTMLTable($heading, $data, $table, $num, $checkhtml) { $this->CI = & get_instanc
public function ColoredHTMLTable($heading, $data, $table, $num, $checkhtml) {
$this->CI = & get_instance();
$tab = $table . "#" . $num;
$alias = empty($this->CI->input->post($tab)) ? $table : $this->CI->input->post($tab);
$this->SetFont('dejavusans', '', 18, '', true);
$html = "<b>$alias</b><br>";
$this->writeHTML($html, true, false, false, false, '');
$this->SetFont('dejavusans', '', 13, '', true);
$html = "<table cellspacing=\"1\" cellpadding=\"0\" width=\"100%\"><thead><tr bgcolor=\"#F6AC00\" border=\"1px\">";
$field = "#" . $num;
$width_array = array();
$i = 0;
foreach ($heading as $fd) {
$str = $table . "_" . $fd . "_alias" . $field;
$width = $table . "_" . $fd . "_width" . $field;
$perc = $this->CI->input->post($width);
array_push($width_array, empty($perc) || $perc < 1 || $perc > 100 ? 0 : $perc);
$alias = empty($this->CI->input->post($str)) ? $fd : $this->CI->input->post($str);
$width = $width_array[$i] != 0 ? "width=\"" . $width_array[$i] . "%\"" : "";
$html .= "<th height=\"40px\" style=\"vertical-align:center\" align=\"center\" $width><b>$alias</b></th>";
$i++;
}
$html .= "</tr></thead><tbody>";
$color = true;
foreach ($data as $row) {
$rgb = $color ? "#FFFFFF" : "#E0E0FF";
$html .= "<tr nobr=\"true\" bgcolor=\"$rgb\" valign=\"center\">";
$i = 0;
foreach ($row as $fd) {
$width = $width_array[$i] != 0 ? "width=\"" . $width_array[$i] . "%\"" : "";
$fd = utf8_encode($fd);
if (!$checkhtml)
$fd = htmlentities($fd);
$html .= "<td style=\"vertical-align:center\" align=\"center\" height=\"40px\" $width>$fd</td>";
$i++;
}
$html .= "</tr>";
$color = !$color;
}
$html .= "</tbody></table><br><br>";
$this->writeHTML($html, true, false, false, false, '');
}
public函数ColoredHTMLTable($heading、$data、$table、$num、$checkhtml){
$this->CI=&get_instance();
$tab=$table.“#”。$num;
$alias=empty($this->CI->input->post($tab))?$table:$this->CI->input->post($tab);
$this->SetFont('dejavusans','',18',,true);
$html=“$alias
”;
$this->writeHTML($html,true,false,false,false,”);
$this->SetFont('dejavusans','',13',,true);
$html=“”;
$field=“#”。$num;
$width_array=array();
$i=0;
foreach(标题为$fd){
$str=$table.“\..$fd.”别名“..$field;
$width=$table.“\..$fd.“\$width...$field;
$perc=$this->CI->input->post($width);
数组推送($width_数组,空($perc)| |$perc<1 | |$perc>100?0:$perc);
$alias=empty($this->CI->input->post($str))?$fd:$this->CI->input->post($str);
$width=$width\u数组[$i]!=0?“width=\.”.$width\u数组[$i]。“%\”“:”;
$html.=“$alias”;
$i++;
}
$html.=”;
$color=true;
foreach($行数据){
$rgb=$color?#FFFFFF:“#E0E0FF”;
$html.=”;
$i=0;
foreach(行为$fd){
$width=$width\u数组[$i]!=0?“width=\.”.$width\u数组[$i]。“%\”“:”;
$fd=utf8_编码($fd);
如果(!$checkhtml)
$fd=htmlentities($fd);
$html.=“$fd”;
$i++;
}
$html.=”;
$color=!$color;
}
$html.=“
”;
$this->writeHTML($html,true,false,false,false,”);
}
其他帖子也可以,打印我想要的,但是代码中的第一篇帖子很奇怪!我试着打印字符串$tab,它是正确的,在我的表单中有名为$tab的输入,所以我试着打印$this->CI->input->post($tab),每次输出字符串“on”。。。它是什么???请帮帮我!今天早上这个打印正常,什么都要打印,现在有些东西坏了
编辑
我已经解决了,视图中有一个冲突,我没有看到,因为很难找到它,无论如何,谢谢 你的视图文件呢?那是因为
#
字符,使用-
代替标题已解决,无意中我给了一个输入相同的名称,出现了冲突,无论如何感谢您的回答!