544782275@qq.com 3 years ago
parent
commit
947cc44106
1 changed files with 19 additions and 0 deletions
  1. 19 0
      application/common.php

+ 19 - 0
application/common.php

@@ -26,6 +26,25 @@ function get_stay_time($remain_time, $is_hour = 1, $is_minutes = 1)
     }
     return $day;
 }
+/**
+ * get请求
+ * @param $url
+ * @param string $msg
+ * @return mixed
+ */
+function requestGet($url , $msg = ''){
+    // 1. 初始化一个cURL会话
+    $ch = curl_init();
+    //设置选项,包括URL
+    curl_setopt($ch, CURLOPT_URL, $url);
+    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+    curl_setopt($ch, CURLOPT_HEADER, 0);
+    //执行并获取HTML文档内容
+    $response = curl_exec($ch);
+    // 4. 释放cURL句柄,关闭一个cURL会话
+    curl_close($ch);
+    return $response;
+}
 //获取全图片地址 $image_data
 function image_path($image_data){
     if(empty($image_data)){