How to write information prompt box in PHP

墨辰丷
Release: 2023-03-29 19:18:02
Original
3179 people have browsed it

This article mainly introduces the method of writing information prompt box in PHP. Interested friends can refer to it. I hope it will be helpful to everyone.

The code is as follows:

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 = "<html>\r\n<head>\r\n<title>系统提示</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$cfg_ver_lang}\" />\r\n";
  $htmlhead .= "<base target=&#39;_self&#39;/>\r\n</head>\r\n<body leftmargin=&#39;0&#39; topmargin=&#39;0&#39;>\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=&#39;$gourl&#39;; pgo=1; }
  }\r\n";
    $rmsg = $func;
    $rmsg .= "document.write(\"<br/><p style=&#39;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;&#39;>系统提示信息:</p>\");\r\n";
    $rmsg .= "document.write(\"<p style=&#39;width:400px;height:100;font-size:10pt;border:1px solid #999999;background-color:#f9fcf3&#39;><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=&#39;" . $gourl . "&#39;>如果你的浏览器没反应,请点击这里...</a>";
      }
      $rmsg .= "<br/><br/></p>\");\r\n";
      if ($gourl != "javascript:;" && $gourl != "") {
        $rmsg .= "setTimeout(&#39;JumpUrl()&#39;,$litime);";
      }
    } else {
      $rmsg .= "<br/><br/></p>\");\r\n";
    }
    $msg = $htmlhead . $rmsg . $htmlfoot;
  }
  if (isset ( $dsql ) && is_object ( $dsql ))
    @$dsql->Close ();
  echo $msg;
}
Copy after login

Summary: The above is the entire content of this article , I hope it can be helpful to everyone’s study.

Related recommendations:

#A simple analysis of the confusion about length calculation in php

php Method and example analysis of using the number_format function to intercept decimals

PHP method and simple example of paging display of data

The above is the detailed content of How to write information prompt box in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template