Many programmers use PHP language for WEB development. Then in websites, you usually encounter functional requirements such as dialog box pop-ups. Below we will introduce in detail the relevant implementation methods of PHP pop-up dialog boxes.
1. PHP pop-up dialog box
< ?PHP echo "< script language= \"JavaScript\">alert (\"你好\");< /script>"; ?> //或者 < ?PHP print "< script language= \"JavaScript\">alert (\"你好\");< /script>"; ?>
2. If you need PHP to pop up a dialog box and return to the original page, you can write like this
< ?PHP echo "< script language= \"JavaScript\">\r\n"; echo " alert(\"你好\");\r\n"; echo " history.back();\r\n"; echo "< /script>"; exit; ?> //或者 < ?PHP print "< script language= \"JavaScript\">\r\n"; print " alert(\"你好\");\r\n"; print " history.back();\r\n"; print "< /script>"; exit; ?>
3. If you need PHP to pop up a dialog box and replace the original page with a new page (replace the current history record), the original page can be written like this
< ?PHP echo "< script language= \"JavaScript\">\r\n"; echo " alert(\"你好\");\r\n"; echo " location.replace (\"http://www.jb51.net/\"); \r\n"; // 自己修改网址 echo "< /script>"; exit; ?> 或者 < ?PHP print "< script language= \"JavaScript\">\r\n"; print " alert(\"你好\");\r\n"; print " location.replace (\"http://www.jb51.net/\"); \r\n"; // 自己修改网址 print "< /script>"; exit; ?>
This article introduces three situations of PHP pop-up dialog boxes, hoping to help everyone master the implementation method of PHP pop-up dialog boxes.