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的站点信息.

 

posted @ 2020-11-17 16:15  华华软件工作室  阅读(124)  评论(0编辑  收藏  举报