cmseasy是一款基于 PHP+Mysql 架构的网站内容管理系统,也是一个 PHP 开发平台。 采用模块化方式开发,功能易用便于扩展,可面向大中型站点提供重量级网站建设解决方案。使用范围非常广泛。本人对该系统还是比较熟悉的,今天我就来分享一下,如何进行二次开发。我以替换短信接口为例,一步一步的手把手教大家开发过程,我们做演示的短信平台是短信宝(https://www.smsbao.com)短信平台,短信宝短信平台是一个非常稳定的短信群发平台,注册还送免费测试短信,大家可以在短信宝平台注册一个账号,进行测试。
第一步:打开项目/lib/plugins/userfunction.php,替换发送短信的业务代码,替换的代码从652行~671行,代码如下图所示:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
function sendMsg($mobile, $content) { $tc = file_get_contents('config/sms.tmp.php'); $tmp = explode('@', $tc); if ($tmp[0] >= config::get('sms_maxnum') && $tmp[1] == date('Y-m-d')) { front::flash('发送失败,请检查用户名、密码或剩余条数'); return -200; } $param['u']=config::get('sms_username'); $param['p']=md5(config::get('sms_password')); $param['m']=$mobile; $param['c']="【".config::get('sms_sign')."】".$content; $res=file_get_contents($url); if ($rs == '0') { $num = $tmp[0] + 1; file_put_contents('config/sms.tmp.php', $num . '@' . date('Y-m-d')); } return $res;} |
修改配置文件,项目/config/config.php文件,1233~1300行左右,替换代码为:
|
1
2
3
4
5
6
7
8
9
10
11
12
|
//sms-短信设置{'sms_username'=>'',//用户名[<span class="hotspot" onmouseover="tooltip.show('请输入短信平台注册时填写的用户名!');" onmouseout="tooltip.hide();"><img src="./images/admin/remind.gif" alt="" width="14" height="20" style="margin-left:10px; margin-right:5px;" /></span>  <a href="https://www.smsbao.com/reg" target=_blank class=btn_a>注册用户</a>]//sms-短信设置{'sms_password'=>'', //密码[<span class="hotspot" onmouseover="tooltip.show('请输入短信平台注册时填写的密码!');" onmouseout="tooltip.hide();"><img src="./images/admin/remind.gif" alt="" width="14" height="20" style="margin-left:10px; margin-right:5px;" /></span>]'sms_sign'=>'',//短信签名[<span class="hotspot" onmouseover="tooltip.show('请输入短信签名!');" onmouseout="tooltip.hide();"><img src="./images/admin/remind.gif" alt="" width="14" height="20" style="margin-left:10px; margin-right:5px;" /></span>  ] |
emseasy5.6 utf8版本系统后台设置登录短信验证不能发送验证码的bug,在此次演示也修复了,修改项目/template/admin/admin/login.php文件,替换代码63~74行左右,替换代码如下:
|
1
2
3
4
5
6
7
8
9
10
11
12
|
<input placeholder="{lang(tel)}" type='text' id="tel" name="tel" value="" tabindex="3" class="input" /><div class="blank20"></div><input id="btm_sendMobileCode" onclick="sendMobileCode('/index.php?case=tool&act=smscode',$('#tel'));" type="button" value="{lang(send_cell_phone_verification_code)}" /><input type='text' placeholder="{lang(please_enter_the_phone_verification_code)}" id="mobilenum" name="mobilenum" /><div class="blank20"></div>{/if}{if config::get('verifycode') == 1}<li><input type='text' id="verify" tabindex="3" name="verify" />{verify()}</li>{/if}{if config::get('verifycode') == 2}<li><div id="verifycode_embed"></div> |
好了,经过以上的替换,短信宝的短信平台已经替换成功了,可以正常使用了。我们可以在短信管理中测试发送。

报备一下短信宝的VIP模板,这样就可以走短信宝的优质通道了,并且免审核了,短信内容3~5秒就可送达。
最新更新
电商类
CMS类
微信类