PHP读取IIS网站列表
<table> <?php error_reporting(0); $con = file_get_contents('sites.xml'); 、、 $a = explode("<SITE SITE",$con); for($i=0;$i<count($a);$i++){ $b = explode(">",$a[$i]); echo "<tr><td>"; echo cut($b[0],'.NAME="','"'); echo "</td><td>"; echo str_replace('" state="Started"','',cut($b[0],'bindings="http/*:80:',',')); echo "</td><td>"; echo cut($a[$i],'physicalPath="','"'); echo "</td></tr>"; } function cut($string,$start,$end){ $message = explode($start,$string); $message = explode($end,$message[1]); return $message[0];} ?> </table>
代码另的site.xml为上文方法导出的IIS的站点信息.