cmseasy是一款基于 PHP+Mysql 架構(gòu)的網(wǎng)站內(nèi)容管理系統(tǒng),也是一個(gè) PHP 開發(fā)平臺(tái)。 采用模塊化方式開發(fā),功能易用便于擴(kuò)展,可面向大中型站點(diǎn)提供重量級(jí)網(wǎng)站建設(shè)解決方案。使用范圍非常廣泛。本人對(duì)該系統(tǒng)還是比較熟悉的,今天我就來分享一下,如何進(jìn)行二次開發(fā)。我以替換短信接口為例,一步一步的手把手教大家開發(fā)過程,我們做演示的短信平臺(tái)是短信寶(http://www.gjrencai.com)短信平臺(tái),短信寶短信平臺(tái)是一個(gè)非常穩(wěn)定的短信群發(fā)平臺(tái),注冊還送免費(fèi)測試短信,大家可以在短信寶平臺(tái)注冊一個(gè)賬號(hào),進(jìn)行測試。
第一步:打開項(xiàng)目/lib/plugins/userfunction.php,替換發(fā)送短信的業(yè)務(wù)代碼,替換的代碼從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( '發(fā)送失敗,請檢查用戶名、密碼或剩余條數(shù)' ); 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 ; } |
修改配置文件,項(xiàng)目/config/config.php文件,1233~1300行左右,替換代碼為:
1
2
3
4
5
6
7
8
9
10
11
12
|
//sms-短信設(shè)置{ 'sms_username'=>'', //用戶名[< span class = "hotspot" onmouseover = "tooltip.show('請輸入短信平臺(tái)注冊時(shí)填寫的用戶名!');" 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.gjrencai.com/reg" target = _blank class = btn_a >注冊用戶</ a >] //sms-短信設(shè)置{ 'sms_password'=>'', //密碼[< span class = "hotspot" onmouseover = "tooltip.show('請輸入短信平臺(tái)注冊時(shí)填寫的密碼!');" 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版本系統(tǒng)后臺(tái)設(shè)置登錄短信驗(yàn)證不能發(fā)送驗(yàn)證碼的bug,在此次演示也修復(fù)了,修改項(xiàng)目/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 > |
好了,經(jīng)過以上的替換,短信寶的短信平臺(tái)已經(jīng)替換成功了,可以正常使用了。我們可以在短信管理中測試發(fā)送。
報(bào)備一下短信寶的VIP模板,這樣就可以走短信寶的優(yōu)質(zhì)通道了,并且免審核了,短信內(nèi)容3~5秒就可送達(dá)。
最新更新
電商類
CMS類
微信類