【发布时间】:2012-09-12 12:11:23
【问题描述】:
我正在尝试替换 xml 中的标签。我已经通过 curl 在变量中存储了一个 xml 结果。并试图制作一个file.xml。 当它
<Topics>
<Topic code="Balances" count="26" pagesize="100" />
</Topics>
使用此函数,它不会返回任何匹配项。为什么?
function get_tag( $tag, $xml ) {
$tag = preg_quote($tag);
preg_match_all('{<'.$tag.'[^>]*>(.*?)</'.$tag.'>}',
$xml,
$matches,
PREG_PATTERN_ORDER);
return $matches[1];
}
【问题讨论】: