search
Homephp教程php手册php中的多种界面跳转方式

php中的多种界面跳转方式

Apr 21, 2017 am 10:13 AM
Wayinterface

方法1: PHP中 header() 函数

<ol class="linenums">
<li class="L0" value="1">
<?php
<li class="L1">header("Location:http://www.php.cn");<li class="L2">
?>

注意:
1. location 与 : 之间不能有空格,否则不会跳转。
2. header()前不能有任何的输出。
3. header()之后的PHP代码还会被执行。

方法2: Meta标签
Meta标签是HTML中负责提供文档元信息的标签,在PHP程序中使用该标签,也可以实现页面跳转。 若定义http-equiv为refresh,则打开该页面时将根据content规定的值在一定时间内跳转到相应页面。若设置content=”秒数;url=网址”,则定义了经过多长时间后页面跳转到指定的网址。

<ol class="linenums">
<li class="L0" value="1">
<html><li class="L1">
<head>
<li class="L2">
<meta http-equiv="refresh" content="1;url= 
<li class="L3">
<title>HTML标题</title>
<li class="L4">
</head>
<li class="L5">
<content>
<li class="L6">PHP中文网欢迎大家光临!<li class="L7"></content>
</html>

方法3: javascript实现

<ol class="linenums">
<li class="L0" value="1">
<script language="javascript" type="text/javascript">
<li class="L1">location.href = "http://www.php.cn";<li class="L2">
</script>


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

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

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)