如何判断POST,GET,AJAX等类提交?

 代码如下:
  1. <?php/*** 是否是AJAx提交的* @return bool*/function isAjax(){if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){return true;}else{return false;}}/*** 是否是GET提交的*/function isGet(){return $_SERVER['REQUEST_METHOD'] == 'GET' ? true : false;}/*** 是否是POST提交* @return int*/function isPost() {return ($_SERVER['REQUEST_METHOD'] == 'POST' && (empty($_SERVER['HTTP_REFERER']) || preg_replace("~https?:\/\/([^\:\/]+).*~i", "\\1", $_SERVER['HTTP_REFERER']) == preg_replace("~([^\:]+).*~", "\\1", $_SERVER['HTTP_HOST']))) ? 1 : 0;}
有什么不懂请留言。