挪用网易云信,实现短信发送linux 查看磁盘空间大小的命令和方法
1.Ubuntu 查看磁盘空间大小命令 df -h Df命令是linux系统以磁盘分区为单位查看文件系统,可以加上参数查看磁盘剩余空间信息, 命令格式: df -hl 显示格式为: 文件系统 容
//网易云信发送短信 //http://dev.netease.im/docs?doc=server&#发送模板短信 function yx_sendsms($mobile='',$params='',$templateid=''){ header("Content-Type:text/html; charset=utf-8"); $AppKey = 'xxx'; $AppSecret = 'xxx'; $Nonce = rand(100000,999999); $CurTime = time(); $CheckSum = strtolower(sha1($AppSecret.$Nonce.$CurTime)); $url = 'https://api.netease.im/sms/sendtemplate.action'; $head_arr = array(); $head_arr[] = 'Content-Type: application/x-www-form-urlencoded'; $head_arr[] = 'charset: utf-8'; $head_arr[] = 'AppKey:'.$AppKey; $head_arr[] = 'Nonce:'.$Nonce; $head_arr[] = 'CurTime:'.$CurTime; $head_arr[] = 'CheckSum:'.$CheckSum; $data = array(); $data['templateid'] = $templateid; $data['mobiles'] = $mobile; $data['params'] = $params; //var_dump($data); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $head_arr); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); curl_setopt($ch, CURLOPT_TIMEOUT, 120); $result = curl_exec($ch); curl_close($ch); $resArr = (array) json_decode($result); //$resArr = (array) json_decode('{"code":200,"msg":"sendid","obj":1}'); //var_dump($resArr); //echo $resArr['code']; return $resArr; } |
Thinkphp连系网易云IM代码类分享
使用网易云IM做APP可以实现私聊、群聊、聊天室等通讯能力功能,网易云IM文档看起来比较复杂,很多新手不知道如何入手,今天跟版网总结一下,分享给大家学习使用。
1.封装的类如下: