1. È¡µÃÇëÇóÐУºMethod¡¢URI¡¢ÐÒé
¿ÉÒÔ´Ó³¬¼¶±äÁ¿$_SERVERÖлñµÃ£¬Èý¸ö±äÁ¿µÄÖµÈçÏ£º
$_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI'].' '.$_SERVER['SERVER_PROTOCOL']."\r\n";
2. È¡µÃËùÓÐHeader
PHPÓиöÄÚÖú¯Êýgetallheader()£¬ÊÇapache_request_headers()º¯ÊýµÄÒ»¸ö±ðÃû£¬¿ÉÒÔ½«HTTPÇëÇóµÄËùÓÐHeaderÒÔÊý×éÐÎʽ·µ»Ø¡£µ«Õâ¸öº¯ÊýÖ»Äܹ¤×÷ÔÚApacheÏ£¬Èç¹û»»ÁËNginx»òÕßÃüÁîÐУ¬»áÖ±½Ó±¨º¯Êý²»´æÔڵĴíÎó¡£
±È½ÏͨÓõķ½·¨ÊÇ£¬´Ó³¬¼¶±äÁ¿$_SERVERÖÐÌáÈ¡³öÀ´£¬ÓйØHeaderµÄ¼üÖµ¶¼ÊÇ¡°HTTP_¡±¿ªÍ·µÄ£¬¿ÉÒÔ¸ù¾Ý´ËÌصãÈ¡µÃËùÓеÄHeader¡£´úÂëÈçÏ£º
function get_all_headers() { $headers = array(); foreach($_SERVER as $key => $value) { if(substr($key, 0, 5) === 'HTTP_') { $key = substr($key, 5); $key = strtolower($key); $key = str_replace('_', ' ', $key); $key = ucwords($key); $key = str_replace(' ', '-', $key); $headers[$key] = $value; } } return $headers; }
3. È¡µÃBody
PHP¹Ù·½ÌṩÁËÒ»ÖÖ»ñÈ¡ÇëÇóBodyµÄ·½·¨£¬¼´£º
file_get_contents('php://input')
4. ×îÖÕ´úÂë
/** * »ñÈ¡HTTPÇëÇóÔÎÄ * @return string */ function get_http_raw() { $raw = ''; // (1) ÇëÇóÐÐ $raw .= $_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI'].' '.$_SERVER['SERVER_PROTOCOL']."\r\n"; // (2) ÇëÇóHeaders foreach($_SERVER as $key => $value) { if(substr($key, 0, 5) === 'HTTP_') { $key = substr($key, 5); $key = str_replace('_', '-', $key); $raw .= $key.': '.$value."\r\n"; } } // (3) ¿ÕÐÐ $raw .= "\r\n"; // (4) ÇëÇóBody $raw .= file_get_contents('php://input'); return $raw; }
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ