search
HomeBackend DevelopmentPHP ProblemHow to implement page jump in php

How to implement page jump in php

Jul 30, 2020 pm 01:53 PM
phpPage jump

How to implement page jump in php: You can use the header() function to achieve it. The specific usage is as follows: [header("Location:https://www.xxx.com");]. It should be noted that there cannot be any output before using the header.

How to implement page jump in php

#It is a very simple method to implement page jump through the header() function.

(Recommended tutorial: php graphic tutorial)

The main function of the header() function is to output the HTTP protocol header (header) to the browser.

The function syntax is as follows:

void header (string string [,bool replace [,int http_response_code]])

Parameter description:

The optional parameter replace indicates whether to replace the previous similar header or add a header of the same type. The default is replace .

The optional parameter http_response_code forces the HTTP corresponding code to the specified value.

The Location type header in the header function is a special header call, often used to implement page jumps.

(Recommended video tutorial: php video tutorial)

Note:

1. There cannot be a space between location and ":" , otherwise it will not jump.

2. There cannot be any output before using the header.

3. The PHP code after the header will also be executed.

Code implementation:

< ?php 
//重定向浏览器 
header("Location: https://www.php.cn/"); 
//确保重定向后,后续代码不会被执行 ......
?>

The above is the detailed content of How to implement page jump in php. For more information, please follow other related articles on the PHP Chinese website!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.