Home > Backend Development > PHP Tutorial > php怎么判断get传值的参数是否存在

php怎么判断get传值的参数是否存在

PHPz
Release: 2020-09-04 18:04:54
Original
4011 people have browsed it

php判断get传值的参数是否存在的方法:首先通过“is_array”函数判断是否通过get传值;然后通过“isset”方法判断是否存在“id”的参数即可。

php怎么判断get传值的参数是否存在

php怎么判断get传值的参数是否存在?

php判断get传值的参数是否存在:

代码示例:

if(is_array($_GET)&&count($_GET)>0)//先判断是否通过get传值了
    {
        if(isset($_GET["id"]))//是否存在"id"的参数
        {
            $id=$_GET["id"];//存在
        }
    }
Copy after login

更多相关技术文章,请访问PHP中文网

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template