Home > Article > Backend Development > How to jump according to specified parameters in php
How to implement php jump according to specified parameters: first create a PHP sample file; then define an array to save the URL to be jumped; finally pass "header('Location:' . $URl[ $ID]);" can be used to achieve the jump.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
php jumps to the specified URL according to the parameters
Specific question: Assume it is a.php file, URL/a.php?id=1. When id=1, it jumps to a URL. When id=2, it jumps to another specified URL?
The implementation code is as follows:
<?php #首先定义一个数组,用来保存要跳转的网址 $URl = array('网址1', '网址2', '网址3'); $ID = $_GET['id'];#接收id值 header('Location:' . $URl[$ID]);
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to jump according to specified parameters in php. For more information, please follow other related articles on the PHP Chinese website!