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

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

WBOY
WBOYOriginal
2016-06-23 13:42:31764browse

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


回复讨论(解决方案)

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

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

Statement:
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