官方已经预制了免费的解决方案,只需要在网站根目录下新建一个sn.html的文件,里面编写自己的提示信息,比如请联系某某,这时候再访问未授权的域名,系统会自动调用sn.html并显示其中的内容。
程序修改办法
文件位置:/core/function/handle.php
搜索:parse_info_tpl()函数
将函数内
$tpl_content = str_replace('{info}', $string, $tpl_content);
替换为:
if (strpos($string, '未匹配到本域名') !== false) { $tpl_content = str_replace('{info}', '您当前域名未授权,请联系开发者获取授权!', $tpl_content); } else { $tpl_content = str_replace('{info}', $string, $tpl_content); }
修改范例可直接复制替换:
/** * 系统信息弹出解析函数 * * @param string $info_tpl模板 * @param string $string内容 * @param string $jump_url跳转地址 * @param number $time时间 */ function parse_info_tpl($info_tpl, $string, $jump_url = null, $time = 0) { if (file_exists($info_tpl)) { $tpl_content = file_get_contents($info_tpl); if ($jump_url) { $timeout_js = "<script>var timeout = {time};var showbox = document.getElementById('time');show();function show(){showbox.innerHTML = timeout+ ' 秒后自动跳转';timeout--;if (timeout == 0) {window.location.href = '{url}';}else {setTimeout(function(){show();}, 1000);}}</script>"; } else { $timeout_js = ''; } $tpl_content = str_replace('{js}', $timeout_js, $tpl_content); if (strpos($string, '未匹配到本域名') !== false) { $tpl_content = str_replace('{info}', '您当前域名未授权,请联系开发者获取授权!', $tpl_content); } else { $tpl_content = str_replace('{info}', $string, $tpl_content); } $tpl_content = str_replace('{url}', $jump_url, $tpl_content); $tpl_content = str_replace('{time}', $time, $tpl_content); $tpl_content = str_replace('{sitedir}', SITE_DIR, $tpl_content); $tpl_content = str_replace('{coredir}', CORE_DIR, $tpl_content); $tpl_content = str_replace('{appversion}', APP_VERSION . '-' . RELEASE_TIME, $tpl_content); $tpl_content = str_replace('{serveros}', PHP_OS, $tpl_content); $tpl_content = str_replace('{serversoft}', $_SERVER['SERVER_SOFTWARE'], $tpl_content); return $tpl_content; } else { exit('<div style="font-size:50px;">:(</div>提示信息的模板文件不存在!'); } }