PHP realizes that the page to be jumped is refreshed once

藏色散人
Release: 2023-03-10 22:16:02
Original
3047 people have browsed it

php method to refresh the page to be jumped: first open the corresponding PHP page code; then implement the jump through the header; finally through "header('refresh:3; url=index.php') ;" Just implement the jump and refresh.

PHP realizes that the page to be jumped is refreshed once

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

php refreshes the page to be jumped

The code is as follows:

PHP page jump:

// 只是跳转,所以一定要用die();或者exit;终止下一步操作;
header('location:index.php');
exit;
// 等待3秒,跳转并刷新
header('refresh:3; url=index.php');
Copy after login

Related introduction:

header() function sends the original HTTP header to the client.

It's important to realize that the header() function must be called before any actual output is sent (in PHP 4 and above, you can use output caching to solve this problem):

<html>
<?php
// 结果出错
// 在调用 header() 之前已存在输出
header(&#39;Location: http://www.example.com/&#39;);
?>
Copy after login

Grammar

header(string,replace,http_response_code)
Copy after login

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of PHP realizes that the page to be jumped is refreshed once. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!