腾讯公益404并不支持 HTTPS 站点的引用,为了公益事业研究了下,发现只要拉到http://qzone.qq.com/gy/404/data.js数据即可,但 HTTPS 站是不能直接拉非安全协议内容,所以还要在自己网站上用一个 PHP 做中转,如下:php
header('Content-type: text/javascript');
$filename = 'data.js';
clearstatcache();
$lastTime = filemtime($filename);
$nowTime = time();
if ($nowTime - $lastTime604800) {
$url = 'http://qzone.qq.com/gy/404/data.js';
$html = file_get_contents($url);
echo $html;
$file = fopen($filename, "w");
fwrite($file, $html);
fclose($file);
} else {
readfile($filename);
}然后就是,用 JS 读数据显示了,不多说,我的代码如下:jQuery.getScript("/gy/404data.php", function () {
va
...
继续阅读
(12)