function ali_getwuliu($no,$typename){ $typeArr = express_data(); $type = ''; if($typename){ $type = $typeArr[$typename]; } if(!$type || !$no) return []; $no = trim($no); $host = "https://wuliu.market.alicloudapi.com";//api访问链接 $path = "/kdi";//API访问后缀 $method = "GET"; $appcode = "609ee6436aaf444a8d17feebe6feb8f0";//替换成自己的阿里云appcode $headers = array(); array_push($headers, "Authorization:APPCODE " . $appcode); $querys = "no={$no}&type={$type}"; //参数写在这里 $bodys = ""; $url = $host . $path . "?" . $querys;//url拼接 $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, false); //curl_setopt($curl, CURLOPT_HEADER, true); 如不输出json, 请打开这行代码,打印调试头部状态码。 //状态码: 200 正常;400 URL无效;401 appCode错误; 403 次数用完; 500 API网管错误 if (1 == strpos("$".$host, "https://")) { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); } return curl_exec($curl); }
时间: 2023-05-20 20:02:11 浏览: 68
我看到你提供了一个 PHP 函数,它似乎是用于获取物流信息的。这个函数使用了阿里云的 API,需要提供一个运单号和快递公司名称作为参数。然后它会返回一个包含物流信息的数组。如果没有提供快递公司名称或者运单号,函数会返回一个空数组。
相关问题
@function color($typeName) { @if $typeName =='grow' { $themeColor: #478efd; } } 优化这句代码
这段代码中的 `@if` 语句只有一个条件分支,因此可以考虑使用 `@each` 来简化代码。具体实现如下:
```
@function color($typeName) {
$typeColors: (
"grow": #478efd,
// 其他类型颜色
);
@each $type, $color in $typeColors {
@if $typeName == $type {
@return $color;
}
}
}
```
这里将 `@if` 语句替换成了 `@each` 循环,循环遍历 `$typeColors` 中的每一个键值对,如果 `$typeName` 等于当前循环的 `$type`,则返回该类型对应的颜色值。这样可以避免使用多个 `@if` 语句,让代码更加简洁易读。
using socket_type = typename Protocol::socket;
这是一个 C++ 的模板元编程语法,用于定义一个类型别名。具体来说,`Protocol` 是一个模板参数,它应该是一个网络协议类,例如 TCP、UDP 等等。`socket_type` 是我们为此协议定义的一个类型别名,它将自动推导出来,应该是 `Protocol` 类中的一个名为 `socket` 的类型。
这个类型别名可以方便我们在代码中使用 `Protocol` 类的 `socket` 类型,避免了每次都要写出完整的类型名的麻烦。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)