Home > Backend Development > PHP Tutorial > 为什么要判断isset后还要判断empty,直接判断empty不是代码更少吗?该怎么处理

为什么要判断isset后还要判断empty,直接判断empty不是代码更少吗?该怎么处理

WBOY
Release: 2016-06-13 12:12:37
Original
950 people have browsed it

为什么要判断isset后还要判断empty,直接判断empty不是代码更少吗?
if(isset($_SERVER['HTTP_RANGE']) && !empty($_SERVER['HTTP_RANGE'])){
}
------解决思路----------------------
先isset是为了防止empty发警告。
------解决思路----------------------
只要 isset($_SERVER['HTTP_RANGE'])  就可以了
只要是断点续传,则 $_SERVER['HTTP_RANGE'] 一定不为空

Related labels:
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