实现随机获取变量$j46里的域名前判断是否可以在微信和QQ内访问如果可以则获取不可以则提示无可用域名$j46 = $confj46;$j47 = $confj47;if $j47 == 1 $domains = explode $j46;$chosen_domain = $domainsarray_rand$domains; 随机获取$j46里的一个值if !isset$_COOKIEredir
$available_domain = ''; foreach ($domains as $domain) { $wechat_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxappid&redirect_uri=http://" . $domain . "&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"; $qq_url = "http://openmobile.qq.com/oauth2.0/m_authorize?response_type=token&client_id=appid&redirect_uri=http://" . $domain . "&scope=all"; $wechat_headers = get_headers($wechat_url); $qq_headers = get_headers($qq_url); if (strpos($wechat_headers[0], '200') !== false && strpos($qq_headers[0], '200') !== false) { // 可以在微信和QQ内访问 $available_domain = $domain; break; } } if ($available_domain) { // 获取可用的域名 $chosen_domain = $available_domain; // 跳转代码 } else { echo '无可用域名';
原文地址: http://www.cveoy.top/t/topic/egNw 著作权归作者所有。请勿转载和采集!