Home > php教程 > php手册 > body text

PHP controls front-end pop-up dialog box

WBOY
Release: 2016-08-22 10:14:32
Original
784 people have browsed it

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 is a partial functional business, so it is placed on the back end to facilitate unified management.

Solution:

 When echoing javascript scripts through php, one thing that needs attention here is the buffer.

 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 the buffering mechanisms of different browsers in the frontend are different. Not delved into 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:

 

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

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template