A method of non-flush implementation of PHP

Source: Internet
Author: User

Method One:

We pass the HTTP 204 status code, the page does not jump. The 1.html code is as follows:
<! DOCTYPE html>
The add.php code is as follows:
<?php$num = file_get_contents ('./num.txt '); $num = Intval ($num) + 1;file_put_contents ('./num.txt ', $num); Header (' http/1.1 204 No Content ');
Method Two: Use the image loading feature to complete the request.
<! DOCTYPE html>
Method Three: Take advantage of css,javascript loading characteristics, complete the request, the same principle as the IMG load. Method Four: The features of the IFRAME using the 2.html code are as follows:
<! DOCTYPE html>
The ret.php code is as follows:
<?php$uname =!empty ($_post[' uname ')? $_post[' uname ': '; $upwd =!empty ($_post[' upwd '])? $_post[' upwd ': '; if ($uname = = ' Admin ' && $upwd = = ' 123456 ') {    echo ' <script> Parent.document.getElementById (' result '). innerhtml= ' OK ';</script> ";} else {    echo "<script>parent.document.getelementbyid (' result '). Innerhtml= ' NO ';</script>";}
We do not jump the form by setting the target to the iframe that the form submits. Can ajax implement file uploads? Analysis, file upload, it is necessary for the client to send the contents of the file to the server, that is, the XHR object in the post data, the file content is also sent to the server. That is, the XHR object can get the content of the file you want to upload, but for security reasons, JS cannot get the contents of the local file. How does the Ajax plugin implement file uploads?
1, iframe2, flash implementation, such as SWFUPLOAD3, HTML5 (add the file read API, make Ajax upload files possible. )

A method of non-flush implementation of PHP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.