PHP method to control the pop-up dialog box in the foreground

墨辰丷
Release: 2023-03-29 08:38:01
Original
1357 people have browsed it

This article will share with you the effect of using php echo to generate a javascript script to control the pop-up dialog box at the front desk. It is very good and has reference value. Friends who are interested can take a look together

Application scenarios:

During the WeChat authorized login process, user confirmation is required, so this requirement is derived;

The reason why the corresponding logic is not placed on the front end is that this part of the logic It is a partial functional business, so it is placed on the back end to facilitate unified management.

Solution:

Echo the javascript script through php. What needs to be paid attention to here is the buffer zone.

The buffer should have three parts, namely php, webserver, and web browser. Real-time output can be achieved through program code or configuration files. Relatively speaking, the backend is controllable, but different browsers buffer the frontend. The mechanisms are different and not explored in depth here. My solution was to allow non-real time output.

One of the requirements for allowing non-real-time output is that the program should not jump after processing the pop-up window. As follows:

<?php
echo "<script> if(confirm( &#39;请选择跳转页面,是跳转到yes.html 否跳转到no.html? &#39;)) location.href=&#39;yes.html&#39;;else location.href=&#39;no.html&#39;; </script>"; 
//以下hearder部分,是不可以加入的。
//header(&#39;location:http://www.baidu.com&#39;); 
?>
Copy after login

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

Related recommendations:

phpDetailed graphic and text explanation of the method of obtaining the number of days of the month and date array according to the year and month

PHP implements the method of obtaining the day of the week for a specified date

PHP implements multi-image upload combined with uploadify plug-in idea analysis

The above is the detailed content of PHP method to control the pop-up dialog box in the foreground. 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