Merge pull request #3 from WengHeng/master

自动检测是否https请求,如果是https则替换不安全http协议为https协议,防止浏览器报不安全连接
pull/13/head
mengkun 2017-07-14 15:12:11 +08:00 committed by GitHub
commit b1f4dd6d56
1 changed files with 2 additions and 0 deletions

View File

@ -10,6 +10,7 @@ require_once('plugns/Meting.php');
use Metowolf\Meting;
if(isset($_SERVER['REQUEST_SCHEME']) && $_SERVER['REQUEST_SCHEME'] == 'https') define('ISHTTPS', true);#检测HTTPS请求
$API = new Meting('netease');
@ -183,6 +184,7 @@ function getParam($key,$default='')
function echojson($data) //json和jsonp通用
{
header("Content-type: application/json");
if(defined('ISHTTPS') && ISHTTPS === true) $data = str_replace('http:\/\/', 'https:\/\/', $data);#如果为https请求则替换http为https
$callback = getParam('callback');
if($callback != "") //输出jsonp格式
{