From eabf44005fa28c03f84fb7004de5b1fa48617d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Fri, 16 Jun 2017 22:39:17 +0800 Subject: [PATCH] =?UTF-8?q?defer=E5=9C=A8=E5=86=85=E8=BF=9Ejs=E4=BC=9A?= =?UTF-8?q?=E6=9C=89bug=EF=BC=8C=E6=9A=82=E6=97=B6=E5=8E=BB=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/helpers/info_helper.php | 7 ++++++- .../htmlcompressor/controllers/index.php | 16 ++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/application/helpers/info_helper.php b/application/helpers/info_helper.php index fc53eb95..99909ace 100644 --- a/application/helpers/info_helper.php +++ b/application/helpers/info_helper.php @@ -296,7 +296,12 @@ function get_content_by_url($url) { curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 - curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器 + if (isset($_SERVER['HTTP_USER_AGENT'])) { + $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; + } else { + $HTTP_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'; + } + curl_setopt($curl, CURLOPT_USERAGENT, $HTTP_USER_AGENT); // 模拟用户使用的浏览器 curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转 curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer if ($method == 'POST' && !empty($data)) { diff --git a/application/third_party/htmlcompressor/controllers/index.php b/application/third_party/htmlcompressor/controllers/index.php index ca1f0e17..95171dfd 100644 --- a/application/third_party/htmlcompressor/controllers/index.php +++ b/application/third_party/htmlcompressor/controllers/index.php @@ -63,15 +63,15 @@ class Index extends CI_Controller { //$js_content.= $link_script->innertext;//js的内容 // $js_content.= $link_script;//js的内容,包含'; //把js移动到页面底部 foreach ($link_js_array as $item) { - $lastload_js.=''; + $lastload_js.=''; } $lastload_js.=$js_content;