💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# php 13位时间戳 ``` <pre class="calibre15">``` <span class="token"><</span><span class="token">?</span>php <span class="token6">/* * @Date: 2020-11-12 14:13:45 * @LastEditTime: 2020-11-14 15:44:34 * 检测网址是否被腾讯管家拦截 */</span> <span class="token2">if</span> <span class="token1">(</span><span class="token3">isset</span><span class="token1">(</span>$_GET<span class="token1">[</span><span class="token4">'ts999'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">)</span> <span class="token1">{</span> <span class="token3">opcache_invalidate</span><span class="token1">(</span><span class="token3">dirname</span><span class="token1">(</span>__FILE__<span class="token1">)</span><span class="token1">.</span><span class="token4">'/str.php'</span><span class="token1">)</span><span class="token1">;</span> echo <span class="token4">'刷新了文'</span><span class="token1">.</span><span class="token3">date</span><span class="token1">(</span><span class="token4">'H:i:s'</span><span class="token1">,</span><span class="token3">time</span><span class="token1">(</span><span class="token1">)</span><span class="token1">)</span><span class="token1">.</span><span class="token4">"\n"</span><span class="token1">;</span> <span class="token1">}</span> echo <span class="token3">task</span><span class="token1">(</span><span class="token4">"binmaosiwang.com"</span><span class="token1">)</span><span class="token1">;</span> <span class="token6">//echo task('abc.cn');</span> <span class="token6">//@ string 被检测的网址</span> <span class="token2">function</span> <span class="token3">task</span><span class="token1">(</span>$<span class="token5">URL</span><span class="token1">)</span> <span class="token1">{</span> <span class="token3">list</span><span class="token1">(</span>$t1<span class="token1">,</span> $t2<span class="token1">)</span> <span class="token">=</span> <span class="token3">explode</span><span class="token1">(</span><span class="token4">' '</span><span class="token1">,</span> <span class="token3">microtime</span><span class="token1">(</span><span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> $randtime <span class="token">=</span> <span class="token1">(</span>float<span class="token1">)</span><span class="token3">sprintf</span><span class="token1">(</span><span class="token4">'%.0f'</span><span class="token1">,</span><span class="token1">(</span><span class="token3">floatval</span><span class="token1">(</span>$t1<span class="token1">)</span><span class="token">+</span><span class="token3">floatval</span><span class="token1">(</span>$t2<span class="token1">)</span><span class="token1">)</span><span class="token">*</span><span class="token5">1000</span><span class="token1">)</span><span class="token1">;</span> $url <span class="token">=</span> <span class="token4">"https://cgi.urlsec.qq.com/index.php?m=gwComplainMergeIntoWechat&a=checkBlackStatus&callback=jQuery111301801650018998766_"</span><span class="token1">.</span>$randtime<span class="token1">.</span><span class="token4">"&url="</span><span class="token1">.</span>$<span class="token5">URL</span><span class="token1">.</span><span class="token4">"&_="</span><span class="token1">.</span>$randtime<span class="token1">;</span> $headers <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> $headers<span class="token1">[</span><span class="token1">]</span><span class="token">=</span> <span class="token4">'Connection: keep-alive'</span><span class="token1">;</span> $headers<span class="token1">[</span><span class="token1">]</span> <span class="token">=</span> <span class="token4">'Content-Type: application/json'</span><span class="token1">;</span> $headers<span class="token1">[</span><span class="token1">]</span> <span class="token">=</span> <span class="token4">'Referer: https://urlsec.qq.com/'</span><span class="token1">;</span> $headers<span class="token1">[</span><span class="token1">]</span> <span class="token">=</span> <span class="token4">'User-Agent: Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Mobile Safari/537.36'</span><span class="token1">;</span> $ch <span class="token">=</span> <span class="token3">curl_init</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> <span class="token6">//初始化init方法</span> <span class="token3">curl_setopt</span><span class="token1">(</span>$ch<span class="token1">,</span> <span class="token5">CURLOPT_RETURNTRANSFER</span><span class="token1">,</span> <span class="token5">1</span><span class="token1">)</span><span class="token1">;</span> <span class="token6">//设定请求返回结果</span> <span class="token3">curl_setopt</span><span class="token1">(</span>$ch<span class="token1">,</span> <span class="token5">CURLOPT_TIMEOUT</span><span class="token1">,</span> <span class="token5">30</span><span class="token1">)</span><span class="token1">;</span><span class="token6">//设置超时时间</span> <span class="token3">curl_setopt</span><span class="token1">(</span>$ch<span class="token1">,</span> <span class="token5">CURLOPT_SSL_VERIFYPEER</span><span class="token1">,</span> <span class="token5">false</span><span class="token1">)</span><span class="token1">;</span> <span class="token6">//忽略证书</span> <span class="token3">curl_setopt</span><span class="token1">(</span>$ch<span class="token1">,</span> <span class="token5">CURLOPT_SSL_VERIFYHOST</span><span class="token1">,</span> <span class="token5">false</span><span class="token1">)</span><span class="token1">;</span> <span class="token6">//忽略证书</span> <span class="token3">curl_setopt</span><span class="token1">(</span>$ch<span class="token1">,</span> <span class="token5">CURLOPT_SSLVERSION</span><span class="token1">,</span> <span class="token5">1</span><span class="token1">)</span><span class="token1">;</span><span class="token6">//忽略证书</span> <span class="token3">curl_setopt</span><span class="token1">(</span>$ch<span class="token1">,</span> <span class="token5">CURLOPT_URL</span><span class="token1">,</span> $url<span class="token1">)</span><span class="token1">;</span> <span class="token6">//指定url</span> <span class="token3">curl_setopt</span><span class="token1">(</span>$ch<span class="token1">,</span> <span class="token5">CURLOPT_HTTPHEADER</span><span class="token1">,</span> $headers<span class="token1">)</span><span class="token1">;</span><span class="token6">//协议头</span> <span class="token3">curl_setopt</span><span class="token1">(</span>$ch<span class="token1">,</span> <span class="token5">CURLOPT_ENCODING</span><span class="token1">,</span> <span class="token4">"gzip"</span><span class="token1">)</span><span class="token1">;</span> $data <span class="token">=</span> <span class="token3">curl_exec</span><span class="token1">(</span>$ch<span class="token1">)</span><span class="token1">;</span> <span class="token6">//发送请求</span> <span class="token6">//var_dump(curl_error($ch));</span> <span class="token3">curl_close</span><span class="token1">(</span>$ch<span class="token1">)</span><span class="token1">;</span> <span class="token6">//关闭curl</span> $start <span class="token">=</span> <span class="token3">strpos</span><span class="token1">(</span>$data<span class="token1">,</span><span class="token4">"\u6ca1\u6709\u62e6\u622a\u8be5\u7f51\u5740"</span><span class="token1">)</span><span class="token1">;</span> $end <span class="token">=</span> <span class="token3">strpos</span><span class="token1">(</span>$data<span class="token1">,</span><span class="token4">'","reCode'</span><span class="token1">)</span><span class="token1">;</span> $subdata <span class="token">=</span> <span class="token3">substr</span><span class="token1">(</span>$data<span class="token1">,</span>$start<span class="token1">,</span>$end<span class="token">-</span>$start<span class="token1">)</span><span class="token1">;</span> <span class="token3">unset</span><span class="token1">(</span>$t1<span class="token1">,</span>$t2<span class="token1">,</span>$randtime<span class="token1">,</span>$url<span class="token1">,</span>$headers<span class="token1">,</span>$data<span class="token1">,</span>$start<span class="token1">,</span>$end<span class="token1">)</span><span class="token1">;</span> <span class="token2">return</span> $subdata<span class="token">==</span><span class="token4">"\u6ca1\u6709\u62e6\u622a\u8be5\u7f51\u5740"</span><span class="token">?</span><span class="token4">'正常'</span><span class="token1">:</span><span class="token4">'拦截'</span><span class="token1">;</span> <span class="token1">}</span> ``` ```