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( '请选择跳转页面,是跳转到yes.html 否跳转到no.html? ')) location.href='yes.html';else location.href='no.html'; </script>"; //以下hearder部分,是不可以加入的。 //header('location:http://www.baidu.com'); ?>
Summary: The above is the entire content of this article, I hope it will be helpful to everyone's study.
Related recommendations:
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!