mirror of
https://github.com/privacy-protection-tools/anti-AD.git
synced 2025-01-22 22:39:16 +08:00
format
This commit is contained in:
parent
2fa12e5910
commit
3f10b9b1cb
@ -6,15 +6,16 @@
|
|||||||
* @author gently
|
* @author gently
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class utils{
|
class utils
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* http get 方法,一般用于下载文件
|
* http get 方法,一般用于下载文件
|
||||||
*
|
*
|
||||||
* @param $url
|
* @param $url
|
||||||
* @return bool|string
|
* @return bool|string
|
||||||
*/
|
*/
|
||||||
public static function http_get($url){
|
public static function http_get($url)
|
||||||
|
{
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
curl_setopt($ch, CURLOPT_HTTPGET, 1);
|
curl_setopt($ch, CURLOPT_HTTPGET, 1);
|
||||||
@ -22,7 +23,7 @@ class utils{
|
|||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_USERAGENT, '^_^ angent 2.2.5/' . phpversion());
|
curl_setopt($ch, CURLOPT_USERAGENT, "^_^ angent 2.2.5/" . phpversion());
|
||||||
$result = curl_exec($ch);
|
$result = curl_exec($ch);
|
||||||
$errno = curl_errno($ch);
|
$errno = curl_errno($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
@ -37,26 +38,27 @@ class utils{
|
|||||||
* @param $arr2
|
* @param $arr2
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function array_merge_plus($arr1, $arr2){
|
public static function array_merge_plus($arr1, $arr2)
|
||||||
if(!is_array($arr1)){
|
{
|
||||||
$arr1 = array();
|
if (!is_array($arr1)) {
|
||||||
|
$arr1 = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_array($arr2)){
|
if (!is_array($arr2)) {
|
||||||
$arr2 = array();
|
$arr2 = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$arr1 = array_merge_recursive($arr1, $arr2);
|
$arr1 = array_merge_recursive($arr1, $arr2);
|
||||||
|
|
||||||
$arr_result = array();
|
$arr_result = [];
|
||||||
foreach($arr1 as $key => $val){
|
foreach ($arr1 as $key => $val) {
|
||||||
$arr_result[$key] = array();
|
$arr_result[$key] = [];
|
||||||
|
|
||||||
if(!is_array($val)){
|
if (!is_array($val)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($val as $k => $v){
|
foreach ($val as $k => $v) {
|
||||||
$arr_result[$key][$k] = is_array($v) ? array_sum($v) : $v;
|
$arr_result[$key][$k] = is_array($v) ? array_sum($v) : $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user