zoe/yii2-telsmser

yii2的SMS扩展

安装: 6

依赖: 0

建议者: 0

安全: 0

星星: 0

关注者: 1

分支: 0

类型:yii2-extension

v1.1 2015-09-10 07:01 UTC

This package is not auto-updated.

Last update: 2024-10-02 10:50:21 UTC


README

使用SMS平台的API发送短信

安装

安装此扩展的首选方法是通过Composer

运行以下命令之一

php composer.phar require liangzoe/yii2-mobilesmser "*"

或者在您的composer.json文件的require部分添加以下内容

"liangzoe/yii2-mobilesmser": "*"

...

使用

  1. 让我们将以下内容添加到主配置文件中的Component配置中
'smser' => [
    'smser' => [
       	  'class' => 'liangzoe\mobilesmser\TextSmser',
	        'url' => '',
	        'username' => '',
	        'password' => '',
    ],
],

```use in phpfile
Yii::$app->smser->sendSMS('手机号码', '短信内容');
```

'''reference in the view'''
   Countdown with jquery
   
   
   <script type="text/javascript">
   
   var wait=60; 
	
		function time(o) {//o为按钮对象
		
			if (wait == 0) { 
		
				o.removeAttribute("disabled"); 
			
				o.value="免费获取短信动态码"; 
				
				wait = 60; 
		
			} else { 
	
				o.setAttribute("disabled", true); //倒计时中,禁止点击按钮
			
				o.value= wait + "秒后重新发送"; 
			
				wait--; 
	
				setTimeout(function() { time(o);}, 1000);
	
			} 
</script>