search
HomeBackend DevelopmentPHP ProblemHow to implement delayed jump in php

How to implement delayed jump in php: 1. Use the "header("refresh:3;url=...");" method to implement delayed jump; 2. Use php's sleep function to implement delayed jump When jumping, the code is like "sleep(3);header('location:...')".

How to implement delayed jump in php

Recommended: "PHP Video Tutorial"

Page delayed jump in php

When I know how to program in PHP, sometimes I submit parameters and need to jump to another page, but before jumping, there is a prompt message that needs to be output, and it stays on the prompt message for a few seconds.

Use the following two methods to implement the delay before jumping:

Method 1:

Output the prompt "Login successful, jumping...", And jump to the Baidu homepage after 3 seconds.

<?php
echo "登录成功,正在跳转....";
header("refresh:3;url=http://www.baidu.com");
?>

Method 2: Use PHP’s sleep() function

<?php
print("登录成功,正在跳转....")
sleep(3);
header(&#39;location:http://www.baidu.com&#39;);
?>

This method can achieve a delayed jump, but there is no delay before the jump. Prompt information output

The above is the detailed content of How to implement delayed 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

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment