《PHP實(shí)例:Thinkphp5結(jié)合layer彈窗定制操作結(jié)果頁(yè)面》要點(diǎn):
本文介紹了PHP實(shí)例:Thinkphp5結(jié)合layer彈窗定制操作結(jié)果頁(yè)面,希望對(duì)您有用。如果有疑問(wèn),可以聯(lián)系我們。
相關(guān)主題:thinkphp教程
PHP學(xué)習(xí)本文實(shí)例為大家分享了Thinkphp5結(jié)合layer彈窗定制頁(yè)面的具體代碼,供大家參考,具體內(nèi)容如下
PHP學(xué)習(xí)1 打開(kāi)應(yīng)用公共文件頁(yè)面??? appliction/common.php,編寫(xiě)以下代碼
PHP學(xué)習(xí)注意: 成功消息的綠色背景部分是iframe 框架寫(xiě)法,如果是普通頁(yè)面.就吧parent去除,改為: self.location.href="'.$url.'" rel="external nofollow" rel="external nofollow"
PHP學(xué)習(xí)
/**
* $msg 待提示的消息
* $url 待跳轉(zhuǎn)的鏈接
* $icon 這里主要有兩個(gè),5和6,代表兩種表情(哭和笑)
* $time 彈出維持時(shí)間(單位秒)
*/
function alert_success($msg='',$url='',$time=3){
$str='<script type="text/javascript" src="/static/admin/lib/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript" src="/static/admin/lib/layer/2.4/layer.js"></script>';//加載jquery和layer
$str.='<script>
$(function(){
layer.msg("'.$msg.'",{icon:"6",time:'.($time*1000).'});
setTimeout(function(){
self.parent.location.href="'.$url.'" rel="external nofollow" rel="external nofollow"
},2000)
});
</script>';//主要方法
return $str;
}
/**
* $msg 待提示的消息
* $icon 這里主要有兩個(gè),5和6,代表兩種表情(哭和笑)
* $time 彈出維持時(shí)間(單位秒)
*/
function alert_error($msg='',$time=3){
$str='<script type="text/javascript" src="/static/admin/lib/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript" src="/static/admin/lib/layer/2.4/layer.js"></script>';//加載jquery和layer
$str.='<script>
$(function(){
layer.msg("'.$msg.'",{icon:"5",time:'.($time*1000).'});
setTimeout(function(){
window.history.go(-1);
},2000)
});
</script>';//主要方法
return $str;
}
PHP學(xué)習(xí)2 使用實(shí)例:
PHP學(xué)習(xí)
public function test(){
return alert_error('您好,歡迎光顧來(lái)到博客園');
}
public function test(){
return alert_success('您好,歡迎來(lái)到博客園!','http://www.cnblogs.com');
}
PHP學(xué)習(xí)?3 效果:
PHP學(xué)習(xí)
PHP學(xué)習(xí)以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持維易PHP.
轉(zhuǎn)載請(qǐng)注明本頁(yè)網(wǎng)址:
http://www.fzlkiss.com/jiaocheng/513.html