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 Article

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.