【发布时间】:2011-10-06 11:13:19
【问题描述】:
这会导致 PHP 内存泄漏吗?
function xml_parse($xmlString)
{
return json_decode(json_encode(new SimpleXMLElement($xmlString)), true);
}
或者我需要像这样取消设置 SimpleXML obj 吗?
function xml_parse($xmlString)
{
$sObj = new SimpleXMLElement($xmlString);
$ret = json_decode(json_encode($sObj), true);
unset($sObj);
return $ret;
}
我在一个大型 foreach 中运行它,因为脚本需要解析大量文件。
【问题讨论】:
标签: php