加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > CMS系统 > Dedecms > 正文

织梦dedecms系统ShowMsg函数妙用

发布时间:2020-12-14 05:19:37 所属栏目:Dedecms 来源:网络整理
导读:在对DedeCMS做2次开发的时候可能提示信息会经常用到,为了方便在此将ShowMsg方法提取出来,使用方法:? ShowMsg(“提示信息”,“进行跳转的页面URL”);? ShowMsg的代码如下:? function ShowMsg($msg,$gourl,$onlymsg = 0,$limittime = 0) //系统提示信息?
在对DedeCMS做2次开发的时候可能提示信息会经常用到,为了方便在此将ShowMsg方法提取出来,使用方法:?
ShowMsg(“提示信息”,“进行跳转的页面URL”);?
ShowMsg的代码如下:?
function ShowMsg($msg,$gourl,$onlymsg = 0,$limittime = 0) //系统提示信息?
{?
/*?
*$msg 信息提示的内容?
*$gourl 需要跳转的网址?
*$onlymsg 1 表示不自动跳转 0表示自动跳转?
*$limittime 跳转的时间?
*/?
?? ?global $dsql,$cfg_ver_lang;?
?? ?if (eregi ( "^gb",$cfg_ver_lang ))?
?? ?$cfg_ver_lang = 'utf-8';?
?? ?$htmlhead = " ?? ? ? ? ? ? ? ? content="text/html; charset=utf-8" />rn";?
?? ?$htmlhead .= " ?? ?$htmlfoot = " rn ??
?? ?if ($limittime == 0)?
?? ? ? ?$litime = 3000;?
?? ?else?
?? ? ? ?$litime = $limittime;?
??
?? ?if ($gourl == "-1") {?
?? ? ? ?if ($limittime == 0)?
?? ? ? ? ? ?$litime = 3000;?
?? ? ? ?$gourl = "javascript:history.go(-1);";?
?? ?}?
??
?? ?if ($gourl == "" || $onlymsg == 1) {?
?? ? ? ?$msg = "?
";?
?? ?} else {?
?? ? ? ?$func = " ? ? var pgo=0;?
?? ? ?function JumpUrl(){?
?? ? ? ?if(pgo==0){ location='$gourl'; pgo=1; }?
?? ? ?}rn";?
?? ? ? ?$rmsg = $func;?
?? ? ? ?$rmsg .= "document.write("?
?? ? ? ?$rmsg .= "
?? ? ? ?$rmsg .= "document.write("
");rn";?
?? ? ? ?$rmsg .= "document.write("".str_replace(""",$msg)."");rn";?
?? ? ? ?$rmsg .= "document.write("";?
?? ? ? ?if ($onlymsg == 0) {?
?? ? ? ? ? ?if ($gourl != "javascript:;" && $gourl != "") {?
?? ? ? ? ? ? ? ?$rmsg .= "?

?? ? ? ? ? ?}?
?? ? ? ? ? ?$rmsg .= "?

?? ? ? ? ? ?if ($gourl != "javascript:;" && $gourl != "") {?
?? ? ? ? ? ? ? ?$rmsg .= "setTimeout('JumpUrl()',$litime);";?
?? ? ? ? ? ?}?
?? ? ? ?} else {?
?? ? ? ? ? ?$rmsg .= "?

?? ? ? ?}?
?? ? ? ?$msg = $htmlhead . $rmsg . $htmlfoot;?
?? ?}?
?? ?if (isset ( $dsql ) && is_object ( $dsql ))?
?? ? ? ?@$dsql->Close ();?
?? ?echo $msg;?
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读