How to jump directly to the page in php

藏色散人
Release: 2023-03-11 18:56:02
Original
17340 people have browsed it

How to directly jump to the page in php: 1. Jump through the header() function; 2. Jump through the Meta tag; 3. Jump through JavaScript.

How to jump directly to the page in php

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

How to jump directly to the page with php?

Several implementation methods of PHP page jump

● PHP page jump 1. header() function

The header() function is used to perform page jump in PHP A very simple way to jump.

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

The header() function is defined as follows:

How to jump directly to the page in php

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

The second 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.

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.

The code is as follows:

How to jump directly to the page in php

● PHP page jump 2. Meta tag

Meta tag is responsible for providing document meta-information in HTML Tag, using this tag in PHP program can also realize page jump.

If http-equiv is defined as refresh, when the page is opened, it will jump to the corresponding page within a certain period of time based on the value specified by the content.

If content="seconds;url=website" is set, it defines how long it will take for the page to jump to the specified URL.

The code is as follows:

How to jump directly to the page in php

##● PHP page jump 3. JavaScript

For example, this code can be placed in any legal part of the program Location.

The code is as follows:

How to jump directly to the page in php

The above are the three PHP page jump implementation methods we introduced to you.

Recommended learning: "

PHP Video Tutorial"

The above is the detailed content of How to jump directly to the page in php. 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!