<?phpclass Response{ public static function xml(){ ? ?header('Content-Type:text/xml'); $xml = "<?xml version='1.0' encoding='UTF-8'?>\n"; $xml.= "<root>\n"; $xml.= "<code>200</code>\n"; $xml.= "<message>數據返回成功</message>\n"; $xml.= "<data>\n"; $xml.= "<id>123</id>\n"; $xml.= "<name>1</name>\n"; $xml.= "</data>\n"; $xml.= "</root>\n"; echo $xml; } }Response::xml();?>
方法里加入 header('Content-Type:text/xml');瀏覽器報錯
weibo_為了胳膊的微博小窩_03566856
2016-08-19 15:29:55