当微信、QQ 无法访问你的网站,这款代码便是破局关键。它能巧妙应对平台限制,优化网络请求,拒绝腾讯访问。无论是企业官网展示,还是个人项目推广,简单嵌入此代码,即可解决在微信、QQ 端访问127.0.0.1,让你的网站被腾讯QQ微信屏蔽实现网站连接不会被拦截。
<?php
if (strpos($_SERVER['HTTP_USER_AGENT'], 'QQ/') || strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger/') || strpos($_SERVER['HTTP_USER_AGENT'], 'MQQBrowser/')) {
echo '<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0;url=http://localhost">
<title>系统错误!无法访问</title><script>window.location.href="http://localhost";</script></head><body>
</body>
</html>';
exit;
}
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/