在php中,当值较大时,输入类型hidden dosent hide in form
我试图将隐藏的输入字段值设置为从数组中获取的xml字符串。 但是在php中,当值较大时,输入类型hidden dosent hide in form,php,html,codeigniter,Php,Html,Codeigniter,我试图将隐藏的输入字段值设置为从数组中获取的xml字符串。 但是hidden字段值显示在html中,而当我将普通文本作为值放入隐藏字段时,它工作正常 //a large sized associative array convert to xml and set as hidden field $item_array=array(); $xml=new SimpleXMLElement('<OriginDestinationOption/&
hidden
字段值显示在html
中,而当我将普通文本作为值放入隐藏字段时,它工作正常
//a large sized associative array convert to xml and set as hidden field
$item_array=array();
$xml=new SimpleXMLElement('<OriginDestinationOption/>');
array_walk_recursive($item_array,array($xml,'addChild'));
echo '<input type="hidden" name="return-xml" value="'.$xml->asXML();.'" />'; ?>
//大型关联数组转换为xml并设置为隐藏字段
$item_array=array();
$xml=新的SimpleXMLElement(“”);
数组\遍历\递归($item\数组,数组($xml,'addChild');
回音“”;?>
但它以html格式显示值。我的代码有什么问题
注意:我正在使用codeigniter framewrok数据将溢出输入。尝试将css作为“溢出:隐藏”添加到输入中
echo '<input type="hidden" style="display:none;" name="return-xml" value="'.str_replace('"',"'",$xml->asXML());.'" />'; ?>
echo';?>
您的值也可能包含双引号,但不应回显“”;?>代码>be回音“”?>
?删除asXML()
处的分号。您的值也可能包含双引号检查“$xml->asXML();”值内的引号。