cmseasy是一款基于 PHP+Mysql 架構的網站內容管理系統,也是一個 PHP 開發平臺。 采用模塊化方式開發,功能易用便于擴展,可面向大中型站點提供重量級網站建設解決方案。使用范圍非常廣泛。本人對該系統還是比較熟悉的,今天我就來分享一下,如何進行二次開發。我以替換短信接口為例,一步一步的手把手教大家開發過程,我們做演示的短信平臺是短信寶(http://www.fyzp06.cn)短信平臺,短信寶短信平臺是一個非常穩定的短信群發平臺,注冊還送免費測試短信,大家可以在短信寶平臺注冊一個賬號,進行測試。
第一步:打開項目/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="http://www.fyzp06.cn/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類
微信類