Use the header () function
Enter the following code at the beginning of the PHP page:
<?php
Header ("Location:http://www.yedward.net");
?>
Then, we named 1.php, when the access to 1.php, will automatically jump to the Www.yedward.net page, it is important to emphasize that the use of this method, you must write this line of code at the top, if you do not want to write in front, I will provide another method later.
Use meta to achieve jumps
Enter the following code in the header of the PHP page or the HTML page:
<meta http-equiv= "Refresh" content= "5;url=http://www.baidu.com" >;
So We name the page 2.php or 3.htm, when access to 2.php or 3.htm, will automatically jump to www.baidu.com this page, note that the content of the number 5 means that after how long to start jumping, here is set 5 means to go through 5 seconds the page will jump to the target page, built Please do not exceed 10 seconds when setting the jump time.
- &NBSP;
use JavaScript to implement the jump
Enter the following code in the PHP page:
<?php
echo "<script language=\" javascript\ ">";
echo "document.location=\" http://www.baidu.com\ "";
echo "</script>";
?
Then we name the page 4.php, and when we visit 4.php, we automatically jump to the www.baidu.com page. It is important to note that the JavaScript script itself is not written in this way, because it is used in PHP, so made some changes, you can directly create a. js file, enter the following code, and then refer to the file later:
<script language= "JavaScript";
document.location= "http://www.baidu.com";
</script>
Let's name it 5.js to make it easier for me to summarize later.
Summary of various jump methods for mixing
Create a new PHP page in which you enter the following code:
<?php
$a = 1;
if ($a ==1)
Include "1.php";
if ($a ==2)
Include "2.php";
if ($a ==3)
Include "3.htm";
if ($a ==4)
echo "<script language=\" javascript\ ">";
echo "document.location=\" http://www.baidu.com\ "";
echo "</script>";
if ($a ==5)
Include "5.js";
?>
Save the file, named index.php, Access index.php can jump in the first method, and then constantly modify $a=1 to 2, 3, 4, 5, then you can achieve the above mentioned methods of jumping. In the end, simply mention, in the above mentioned methods, only in the "Use Meta implementation Jump" method mentioned in the jump time setting, then how to set the jump time in other methods, you can use the next sleep () function,