我想将隐藏的输入字段值设置为从数组中获得的xml字符串。 但hidden
字段值显示在html
而当我把一个正常的文本作为价值的隐藏领域,它工作正常。输入类型隐藏剂量隐藏在表单中当值更大时在php
//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();.'" />'; ?>
但它显示在html表单中的值。我的代码有什么问题?
注:我用笨framewrok
这也有可能是你的价值观包含双引号 –
不应该'回声“ asXML();.'”/>'; ?>''echo''input type =“hidden”name =“return-xml”value =“'。$ xml-> asXML()。'”/>'?>'?在'asXML()'中移除分号。 – hzq