这是否会导致PHP内存泄漏?这是否会导致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中运行这个脚本需要解析很多文件。
看起来像https://bugs.php.net/bug.php?id=62468 – Zyava