我正在使用:CakePHP 2.5.6
试着像这样读取响应的长度:
App::uses('Controller', 'Controller');
Class AppController extends Controller {
public function afterFilter() {
parent::afterFilter();
pr($this->response->length());
}
}
但无效,返回的值为空 我该怎么做?
答案 0 :(得分:0)
您应该尝试$this->response->length();
编辑:
或者使用$this->response->header();
在这两种情况下,您获得的价值可能都不准确,因为网络服务器可以更改内容/标题并调整大小。