public static function isAjax() { if (isset ( $_SERVER ['HTTP_X_REQUESTED_WITH'] )) { if ('xmlhttprequest' == strtolower ( $_SERVER ['HTTP_X_REQUESTED_WITH'] )) return true; } //如果参数传递的参数中有ajax if (! empty ( $_POST ['ajax'] ) || ! empty ( $_GET ['ajax'] )) { return true; } return false; }