Table of Contents
How to quickly generate various information prompt boxes in PHP, generate information in php
Articles you may be interested in:
Home Backend Development PHP Tutorial How to quickly generate various information prompt boxes with PHP, php generates information_PHP tutorial

How to quickly generate various information prompt boxes with PHP, php generates information_PHP tutorial

Jul 12, 2016 am 08:59 AM
php Prompt box

How to quickly generate various information prompt boxes in PHP, generate information in php

This article describes the method of quickly generating various information prompt boxes in PHP. Share it with everyone for your reference, the details are 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='_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;
}

Copy after login

Readers who are interested in more PHP-related content can check out the special topics of this site: "Introduction Tutorial on PHP Basic Syntax", "Summary of Common PHP Functions and Techniques" and "Introduction Tutorial on PHP Object-Oriented Programming"

I hope this article will be helpful to everyone in PHP programming.

Articles you may be interested in:

  • PHP implements a prompt box similar to alert() in js
  • PHP pops up a prompt box and jumps to a new page, i.e. redirects to a new page Page
  • Two ways to use PHP to implement a pop-up message prompt box
  • php ajax to imitate Baidu search drop-down automatic prompt box (with examples)
  • php simple prompt box alert package Function

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1098690.htmlTechArticleHow to quickly generate various information prompt boxes with PHP, PHP generates information. This article describes the example of PHP quickly generating various information. Tip box method. Share it with everyone for your reference, the details are as follows:...
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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

CakePHP Date and Time

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

CakePHP File upload

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

CakePHP Project Configuration

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

CakePHP Routing

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

Discuss CakePHP

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP Quick Guide

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

How To Set Up Visual Studio Code (VS Code) for PHP Development

See all articles