Skip to content

Commit

Permalink
docs: rename hosts begin str
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed May 13, 2022
1 parent dbdfcf5 commit 2990ed0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -6,7 +6,7 @@
## 使用方法
### Unix/Linux
```shell
sed -i "/# fetch-github-host begin/Q" /etc/hosts && curl https://hosts.gitcdn.top/hosts.txt >> /etc/hosts
sed -i "/# fetch-github-hosts begin/Q" /etc/hosts && curl https://hosts.gitcdn.top/hosts.txt >> /etc/hosts
```
> 提示:可以设置定时任务定时获取更新即可
Expand Down
4 changes: 2 additions & 2 deletions fetch_hosts.php
Expand Up @@ -41,14 +41,14 @@
];

$github_hosts = [];
$hosts_content = "# fetch-github-host begin\n";
$hosts_content = "# fetch-github-hosts begin\n";
foreach ($github_urls as $url) {
$item = [gethostbyname($url), $url];
$github_hosts[] = $item;
$hosts_content .= str_pad($item[0], 28) . $item[1] . "\n";
}
$utc_date = date('c');
$hosts_content .= "# last fetch time: $utc_date\n# update url: https://hosts.gitcdn.top/hosts.txt\n# fetch-github-host end\n\n";
$hosts_content .= "# last fetch time: $utc_date\n# update url: https://hosts.gitcdn.top/hosts.txt\n# fetch-github-hosts end\n\n";

$template = file_get_contents('index-template.php');
file_put_contents('index.php', str_replace('<!--time-->', $utc_date, $template));
Expand Down

0 comments on commit 2990ed0

Please sign in to comment.