这里分享的是动力思维乐信第三方短信接口的demo,阅读demo前,需要先了解以下几点:
乐信短信接口API文档(http://www.lx598.com/apitext.html ),了解更多请移步乐信官网(http://www.lx598.com/ )<?php
require_once 'HttpClient.class.php';
class dlswSdk {
const HOST = 'www.lx198.com';
/**
* 发送短信
* @param $user 用户名
* @param $password 密码
* @param $content 内容后加签名
* @param $mobiles 手机号多个手机号之间英文半角逗号隔开
* @return 服务端返回的结果 ok:业务id 或者 错误代码
*/
final public static function sendSms($user, $password,$content,$mobiles) {
$client = new HttpClient ( self::HOST );
$client->setDebug ( true );
$seed=date ( 'YmdHis' );
if (! $client->post ( '/sdk/send2', array (
'accName' => $user,
'accPwd' => strtoupper(md5(strtoupper ( md5 ( $password ))+$seed )),
'seed' => $seed,
'content' => mb_convert_encoding ( $content, 'UTF-8', 'UTF-8' ),
'aimcodes' =>$mobiles
) )) {
return '-10000';
} else {
return $client->getContent () ;
}
}
/**
* 查询余额
* @param $user 用户名
* @param $password 原始密码
*/
final public static function qryBalance($user, $password) {
$client = new HttpClient ( self::HOST );
$client->setDebug ( true );
$seed=date ( 'YmdHis' );
if (! $client->post ( '/sdk/qryBalance2', array (
'accName' => $user,
'accPwd' => strtoupper(md5(strtoupper ( md5 ( $password ))+$seed )),
'seed' => $seed
) )) {
return '-10000';
} else {
return $client->getContent () ;
}
}
/**
* 查询回执报告
* @param $user 用户名
* @param $password 原始密码
* @param $seed 当前时间 格式:YYYYMMDD HHMISS 例如:20130806102030
* @return 返回的查询报告结果 格式为:业务id,手机号,状态;业务id,手机号,状态
状态1表示成功;0表示失败
*/
final public static function qryReport($user, $password) {
$client = new HttpClient ( self::HOST );
$client->setDebug ( true );
$seed=date ( 'YmdHis' );
if (! $client->post ( '/sdk/qryReport2', array (
'accName' => $user,
'accPwd' => strtoupper(md5(strtoupper ( md5 ( $password ))+$seed )),
'seed' => $seed
) )) {
return '-10000';
} else {
return $client->getContent () ;
}
}
/**
* 查询上行短信
* @param $user 用户名
* @param $password 密码
* @param $seed 当前时间 格式:YYYYMMDD HHMISS 例如:20130806102030
* @return 返回的上行短信信息格式为:签名$$上行手机号$$上行内容$$上行
时间####签名$$上行手机号$$上行内容$$上行时间
*/
final public static function receiveSms($user, $password) {
$client = new HttpClient ( self::HOST );
$client->setDebug ( true );
$seed=date ( 'YmdHis' );
if (! $client->post ( '/sdk/receiveSms2', array (
'accName' => $user,
'accPwd' => strtoupper(md5(strtoupper ( md5 ( $password ))+$seed )),
'seed' => $seed
) )) {
return '-10000';
} else {
return $client->getContent () ;
}
}
}
print(dlswSdk::sendSms( 'user', 'password','content','mobiles'));
print(dlswSdk::qryBalance( 'user', 'password,'));
print(dlswSdk::qryReport( 'user', 'password,'));
print(dlswSdk::receiveSms( 'user', 'password,'));
?>
在PHP中可以使用:strtoupper()函数、strtolower()函数、ucfirst()函数、lcfirst() 函数对字符串进行大小写处理。下面本篇文章就来给大家具体介绍一下,希望对大家有所帮助。strtoupper()函数strtouppe...
[PHP源码阅读]strtolower和strtoupper函数,strtoupper字符串的操作函数中,字符串的大小写转换也算是比较常用的函数,其底层实现也比较简单,下面来一探究竟。
我在github上有对PHP源码更详细的注解。感兴趣的可以...
...ok){ foreach ($book->attributes as $attr) { echo strtoupper($attr->nodeName).' —— '.$attr->nodeValue.''; } echo "AU
...ame' => $user,
'accPwd' => strtoupper(md5(strtoupper ( md5 ( $password ))+
...ews)."})",$show_news)) { $show_news="ALL"; }
if (strtoupper($show_news)=="ALL") { $sql="select date_format(n_date,'%m/%d/%Y') as n_date, date_form
...min_pwd = '$oldpwd'"); if(mysql_num_rows($result)!=0){ if(strtoupper($pwd) == strtoupper($re_pwd)){ $sql=mysql_query("SELECT admin_user,mob
preg_replace(array('/(^|_|-)+(.)/e', '/\.(.)/e'), array("strtoupper('\\2')", "'_'.strtoupper('\\1')"), $id); 各位为大神,替换为preg_replace_callback怎么写啊
strtoupper() 函数把字符串转换为大写而strtolower函数: 该函数将传入的字符串参数所有的字符都转换成小写,并以小定形式放回这个字符串。下面通过本文给大家分享php大小写转换函数(strtolower、strtoupper)用法,需要的朋友参考下吧
... if ($case == "upper")
{
$news .= strtoupper($ch);
}
elseif ($case == "low