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

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

WBOY
Release: 2016-06-23 13:42:31
Original
762 people have browsed it

if(isset($_SERVER['HTTP_RANGE']) && !empty($_SERVER['HTTP_RANGE'])){
}


回复讨论(解决方案)

先isset是为了防止empty发警告。

只要 isset($_SERVER['HTTP_RANGE'])  就可以了
只要是断点续传,则 $_SERVER['HTTP_RANGE'] 一定不为空

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