判断请求是否来自 XMLHttpRequest 对象的的方法: 如果请求来自XMLHttpRequest, 服务器端将存在$_SERVER['HTTP_X_REQUESTED_WITH']变量,由此可以判断。下面摘自Zend_Controller_Request_Http, /** * Is the request a Javascript XMLHttpRequest? * * Should work with Prototype/Script.aculo.us, possibly others. * * @return boolean */ public function isXmlHttpRequest() { return ($this->getHeader('X_REQUESTED_WITH') == 'XMLHttpRequest'); }
阅读(1563) | 评论(0) | 转发(0) |