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

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

WBOY
WBOYOriginal
2016-06-13 12:12:37930browse

为什么要判断isset后还要判断empty,直接判断empty不是代码更少吗?
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