Home > Backend Development > PHP Tutorial > Key points for using php header function

Key points for using php header function

WBOY
Release: 2016-07-25 08:51:23
Original
994 people have browsed it
  1. if(true)
  2. {
  3. header('location:http://bbs.it-home.org');
  4. }
  5. file_put_contents('test.txt', 'ok');//This That’s it, generate a test.txt file with the content ok
Copy the code

In this code, a careless programmer will think that header('location:http://bbs.it-home.org '); is over. In fact, the background code is still executed, so when using header(location), whether it is encapsulated in another function or written directly, it is recommended to add exit() at the end to confirm the program. Abort.

>>>> Articles you may be interested in: Simple example of php header() function Example code for file download using php header function Detailed explanation of usage examples of header function in php Detailed explanation of php header usage php header function directly prompts for the saved code when downloading the file php header information application example Detailed explanation of php file header information Detailed explanation on the use of PHP header() function Detailed explanation of HEADER header message in PHP

>>>>



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