drasv0904 2011-12-14 03:00 采纳率: 0%
浏览 564
已采纳

XMLHttpRequest和HttpRequest之间有什么区别

In Zend Framework and other framework such as Symfony, there is a method named isXMLHttpRequest() to determine this is XMLHttpRequest or not. I wonder that how can framework or PHP distinguish between XmlHttpRequest and HttpRequest?

if($this->_request->isXmlHttpRequest())
{
   //code here
}
  • 写回答

1条回答 默认 最新

  • douyang5943 2011-12-14 03:04
    关注

    From the documentation:

    Zend_Controller_Request_Http has a rudimentary method for detecting AJAX requests: isXmlHttpRequest(). This method looks for an HTTP request header X-Requested-With with the value 'XMLHttpRequest'; if found, it returns TRUE.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?