作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我一直看到开发人员在 Zend 中的一些代码之后进行模式化,我试图弄清楚为什么 Zend 可能以这种方式实现 http 响应代码检查:
/**
* Check whether the response in successful
*
* @return boolean
*/
public function isSuccessful()
{
$restype = floor($this->code / 100);
if ($restype == 2 || $restype == 1) { // Shouldn't 3xx count as success as well ???
return true;
}
return false;
}
具体来说,为什么他们会这样做而不是
public function isSuccessful()
{
return $this->code >= 100 && $this->code < 300
}
最佳答案
也许是因为他们只是在乎
5 03
4 04
4 01
3 02
2 01
等等,基本上对errortype的类不感兴趣
关于php - 为什么 Zend_Http_Response 将状态码除以 100,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25205680/
我一直看到开发人员在 Zend 中的一些代码之后进行模式化,我试图弄清楚为什么 Zend 可能以这种方式实现 http 响应代码检查: /** * Check whether the respons
您好,想知道 $response->getBody() 和 $response->getRawBody() 之间的区别是什么; $this->_client->setUri('http://www.g
我是一名优秀的程序员,十分优秀!