PHP如何解析这种格式的文件
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><accounts>[email protected] bindlan=none auto_bindmac=yes cn=包 [email protected] auto_bindmac=yes bindlan=none cn=包 [email protected] bindlan=none cn=- desc=- maxlogin=1</accounts>
$s = [email protected] bindlan=none auto_bindmac=yes cn=包 [email protected] auto_bindmac=yes bindlan=none cn=包 [email protected] bindlan=none cn=- desc=- maxlogin=1TXT;$s = str_replace(' ', "\n", $s);$s = str_replace('', "]", $s);$p = parse_ini_string($s, 1);print_r($p);<br><font color="#e78608">------解决方案--------------------</font><br>
$s = [email protected] bindlan=none auto_bindmac=yes cn=包 [email protected] auto_bindmac=yes bindlan=none cn=包 [email protected] bindlan=none cn=- desc=- maxlogin=1TXT;preg_match_all("/[\S]+=[^\s]*/",$s,$c);print_r($c);<br><font color="#e78608">------解决方案--------------------</font><br>楼上2种方法都可以<br><br><br>郑州PHP.Net<br>http://www.zzphp.net/<br><font color="#e78608">------解决方案--------------------</font><br>parse_ini_string 第一次看到呢.<div class="clear"> </div>