Home >php教程 >PHP源码 >列出hosts中绑定的域名

列出hosts中绑定的域名

PHP中文网
PHP中文网Original
2016-05-25 16:58:451441browse

在开发项目的过程中绑定的域名过多的时候,难免会忘记一些,这个脚本就是列出这些hosts,可以加入到localhost的默认页面中

<br>===hosts=============
<?php
if($hosts = file_get_contents(&#39;C:WindowsSystem32driversetchosts&#39;)){
$hosts = preg_replace(&#39;/d+.d+.d+.d+/&#39;, &#39;<br>&#39;, $hosts);
$hosts = preg_replace(&#39;/([^ | rn | t]+)/&#39;, &#39;<a target="_blank"href="http://${1}/">${1}</a>&#39;, $hosts);
echo ($hosts);
}
?>
<br>=====================


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn