HTML如何转XTML

 ob_start();
$html = curl_init('http://www.beijing.gov.cn/');
curl_exec($html);
$html = iconv('GBK','UTF-8',$html);
$config = array('indent' => TRUE,
'output-xhtml' => TRUE,
'wrap' => 200);
$tidy = tidy_parse_string($html,$config,'UTF8');
$tidy->cleanRepair();
$tidyhtml = (string)$tidy;
$xml = simplexml_load_string($tidyhtml);
echo $tidyhtml;
var_dump($xml);
上一篇:OC中的类型强制转换


下一篇:3.Java基础之Date对象