新建站点 —— 新建 index.php—— 粘贴下方代码 —— 设置此站点为默认站点 —— 关闭 SSL
页面思路:其他人 a 解析到你的服务器,访问页面获取来访域名,将其显示在页面中;
给域名添加 tk.xxx.xx 的 txt 记录,值为 mail-xxx@xx.xx,页面获取此域名的 txt 记录,并将记录中邮箱显示在页面中。
<?php
$currentDomain = $_SERVER['HTTP_HOST'];
if (strpos($currentDomain, 'www.') === 0) {
$currentDomain = substr($currentDomain, 4);
}
$txtDomain = "tk." . $currentDomain;
$contactEmail = "未找到联系方式";
if (function_exists('dns_get_record')) {
$records = dns_get_record($txtDomain, DNS_TXT);
foreach ($records as $record) {
if (isset($record['txt'])) {
$txtValue = $record['txt'];
if (preg_match('/mail-(.*)/', $txtValue, $matches)) {
$contactEmail = $matches[1];
break;
}
}
}
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $currentDomain; ?> 出售中</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f4f4f9;
color: #333;
}
h1 {
font-size: clamp(1.5rem, 5vw, 3rem);
margin-bottom: 1rem;
}
p {
font-size: clamp(1rem, 3vw, 1.5rem);
}
</style>
</head>
<body>
<h1><?php echo $currentDomain; ?> 正在出售中</h1>
<p>联系方式: <?php echo $contactEmail; ?></p>
</body>
</html>
![图片[1]|域名公共停靠页思路|不死鸟资源网](https://www.busi.net/wp-content/uploads/2025/06/20250609094339906-image-1024x447.png)
注释:设置默认站点后无需绑定域名,单方面解析即可。
本站资源均为作者提供和网友推荐收集整理而来,仅供学习和研究使用,请在下载后24小时内删除,谢谢合作!
THE END