PHP快速生成各種信息提示框的方法
本文實(shí)例講述了PHP快速生成各種信息提示框的方法。分享給大家供大家參考,具體如下:
function ShowMsg($msg, $gourl, $onlymsg = 0, $limittime = 0) //系統(tǒng)提示信息
{
/*
*$msg 信息提示的內(nèi)容
*$gourl 需要跳轉(zhuǎn)的網(wǎng)址
*$onlymsg 1 表示不自動(dòng)跳轉(zhuǎn) 0表示自動(dòng)跳轉(zhuǎn)
*$limittime 跳轉(zhuǎn)的時(shí)間
*/
global $dsql, $cfg_ver_lang;
if (eregi ( "^gb", $cfg_ver_lang ))
$cfg_ver_lang = 'utf-8';
$htmlhead = "<html>\r\n<head>\r\n<title>系統(tǒng)提示</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$cfg_ver_lang}\" />\r\n";
$htmlhead .= "<base target='_self'/>\r\n</head>\r\n<body leftmargin='0' topmargin='0'>\r\n<center>\r\n<script>\r\n";
$htmlfoot = "</script>\r\n</center>\r\n</body>\r\n</html>\r\n";
if ($limittime == 0)
$litime = 5000;
else
$litime = $limittime;
if ($gourl == "-1") {
if ($limittime == 0)
$litime = 5000;
$gourl = "javascript:history.go(-1);";
}
if ($gourl == "" || $onlymsg == 1) {
$msg = "<script>alert(\"" . str_replace ( "\"", "“", $msg ) . "\");</script>";
} else {
$func = " var pgo=0;
function JumpUrl(){
if(pgo==0){ location='$gourl'; pgo=1; }
}\r\n";
$rmsg = $func;
$rmsg .= "document.write(\"<br/><div style='width:400px;padding-top:4px;height:24;font-size:10pt;border-left:1px solid #999999;border-top:1px solid #999999;border-right:1px solid #999999;background-color:#CCC;'>系統(tǒng)提示信息:</div>\");\r\n";
$rmsg .= "document.write(\"<div style='width:400px;height:100;font-size:10pt;border:1px solid #999999;background-color:#f9fcf3'><br/><br/>\");\r\n";
$rmsg .= "document.write(\"" . str_replace ( "\"", "“", $msg ) . "\");\r\n";
$rmsg .= "document.write(\"";
if ($onlymsg == 0) {
if ($gourl != "javascript:;" && $gourl != "") {
$rmsg .= "<br/><br/><a href='" . $gourl . "'>如果你的瀏覽器沒反應(yīng),請(qǐng)點(diǎn)擊這里...</a>";
}
$rmsg .= "<br/><br/></div>\");\r\n";
if ($gourl != "javascript:;" && $gourl != "") {
$rmsg .= "setTimeout('JumpUrl()',$litime);";
}
} else {
$rmsg .= "<br/><br/></div>\");\r\n";
}
$msg = $htmlhead . $rmsg . $htmlfoot;
}
if (isset ( $dsql ) && is_object ( $dsql ))
@$dsql->Close ();
echo $msg;
}
更多關(guān)于PHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《PHP基本語法入門教程》、《php常用函數(shù)與技巧總結(jié)》及《php面向?qū)ο蟪绦蛟O(shè)計(jì)入門教程》
希望本文所述對(duì)大家PHP程序設(shè)計(jì)有所幫助。
相關(guān)文章
PHP使用內(nèi)置函數(shù)file_put_contents寫入文件及追加內(nèi)容的方法
這篇文章主要介紹了PHP使用內(nèi)置函數(shù)file_put_contents寫入文件及追加內(nèi)容的方法,結(jié)合實(shí)例形式分析了file_put_contents函數(shù)通過參數(shù)設(shè)置實(shí)現(xiàn)寫入文件及追加內(nèi)容的相關(guān)技巧,非常簡(jiǎn)單實(shí)用,需要的朋友可以參考下2015-12-12
解析:通過php socket并借助telnet實(shí)現(xiàn)簡(jiǎn)單的聊天程序
本篇文章是對(duì)通過php socket并借助telnet實(shí)現(xiàn)簡(jiǎn)單聊天程序的方法進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-06-06
PHP輸出兩個(gè)數(shù)字中間有多少個(gè)回文數(shù)的方法
這篇文章主要介紹了PHP輸出兩個(gè)數(shù)字中間有多少個(gè)回文數(shù)的方法,實(shí)例分析了回文數(shù)的概念與相關(guān)判斷技巧,需要的朋友可以參考下2015-03-03
如何阻止網(wǎng)站被惡意反向代理訪問(防網(wǎng)站鏡像)
最近有人用小站數(shù)據(jù),利用反向代理技術(shù),做了個(gè)小偷站。用戶訪問的是他的網(wǎng)址,但實(shí)質(zhì)上內(nèi)容數(shù)據(jù)確是我的,這是一起惡意反向代理事件2014-03-03

