Home > php教程 > PHP源码 > body text

列出hosts中绑定的域名

PHP中文网
Release: 2016-05-25 16:58:45
Original
1373 people have browsed it

在开发项目的过程中绑定的域名过多的时候,难免会忘记一些,这个脚本就是列出这些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>=====================
Copy after login


Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!