search
Homephp教程php手册PHP快速生成各种信息提示框的方法,php生成信息

PHP快速生成各种信息提示框的方法,php生成信息

本文实例讲述了PHP快速生成各种信息提示框的方法。分享给大家供大家参考,具体如下:

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='_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;'>系统提示信息:</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 . "'>如果你的浏览器没反应,请点击这里...</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;
}

更多关于PHP相关内容感兴趣的读者可查看本站专题:《PHP基本语法入门教程》、《php常用函数与技巧总结》及《php面向对象程序设计入门教程》

希望本文所述对大家PHP程序设计有所帮助。

您可能感兴趣的文章:

  • PHP 实现类似js中alert() 提示框
  • PHP弹出提示框并跳转到新页面即重定向到新页面
  • 用PHP实现弹出消息提示框的两种方法
  • php+ajax做仿百度搜索下拉自动提示框(有实例)
  • php简单提示框alert封装函数
Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software