带$ _GET参数的PHP xmlparser
问题描述:
我使用xml_parser来解析xml。当我有像
$simple = "<para><note>simple note</note></para>";
它的工作原理。但问题是当我使用$ _GET参数。
$simple = "<para><note>simple note</note></para>";
$parser = xml_parser_create();
$valid = xml_parse_into_struct($parser, $simple, $response, $index);
xml_parser_free($parser);
echo $valid;
当运行xml.php,则返回1。它的工作原理
$simple= $_GET['simple'];
$parser = xml_parser_create();
$valid = xml_parse_into_struct($parser, $simple, $response, $index);
xml_parser_free($parser);
echo $valid;
当运行
xml.php?simple=<para><note>simple note</note></para>
它返回0。doesn't工作。
但是$ _GET参数确定:
echo $_GET['simple]
打印
<para><note>simple note</note></para>
顺便说一句,我有魔术引号了。
非常感谢您
答
既然你看到屏幕/浏览器是什么<para><note>simple note</note></para>
这可能意味着<
和>
是不是真的标记分隔符。 (但是>
和<
) 做回声时,请在页面上查看源代码,并且真相会显示出来。
非常感谢。这是关键。我用html_entity_decode($简单),它的工作!这个问题的答案多快!我已经超过1小时搜索并尝试...再次感谢马克和你,Itay – Alberto
@Alberto =如果这个答案正确地描述了问题,你可以随时接受它... –