PHP Class daixianceng\smser\Smser

Author: Cosmo ([email protected])
Inheritance: extends yii\base\Component
显示文件 Open project: daixianceng/yii2-smser Class Usage Examples

Public Properties

Property Type Description
$fileMode boolean 是否启用文件模式
$url string 请求地址
$username string 用户名

Protected Properties

Property Type Description
$message string 状态信息
$password string 密码
$state string 状态码

Public Methods

Method Description
getMessage ( ) : string 获取状态信息
getState ( ) : string 获取状态码
send ( string $mobile, string $content ) : boolean 发送短信
sendByTemplate ( string $mobile, mixed $data, number $id ) : boolean 发送模板短信
setPassword ( string $password ) 设置密码
setUseFileTransport ( boolean $value ) Whether to use file mode.

Private Methods

Method Description
_sendAsFile ( string $mobile, string $content ) : boolean 用于存储短信内容

Method Details

getMessage() public method

获取状态信息
public getMessage ( ) : string
return string

getState() public method

获取状态码
public getState ( ) : string
return string

send() public method

发送短信
public send ( string $mobile, string $content ) : boolean
$mobile string 对方手机号码
$content string 短信内容
return boolean 短信是否发送成功

sendByTemplate() public method

发送模板短信
public sendByTemplate ( string $mobile, mixed $data, number $id ) : boolean
$mobile string 对方手机号码
$data mixed 键值对
$id number 模板id
return boolean 短信是否发送成功

setPassword() public method

设置密码
public setPassword ( string $password )
$password string

setUseFileTransport() public method

Whether to use file mode.
public setUseFileTransport ( boolean $value )
$value boolean

Property Details

$fileMode public_oe property

是否启用文件模式
public bool $fileMode
return boolean

$message protected_oe property

状态信息
protected string $message
return string

$password protected_oe property

密码
protected string $password
return string

$state protected_oe property

状态码
protected string $state
return string

$url public_oe property

请求地址
public string $url
return string

$username public_oe property

用户名
public string $username
return string