Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

[Ô­´´] PHP ¼æÈÝ Curl/Socket/Stream µÄ HTTP ²Ù×÷Àà

<?php
/************************************************************
* ÃèÊö£ºHTTP²Ù×÷Àà
* ×÷Õߣºheiyeluren
* ´´½¨£º2009/12/13 04:43
* Ð޸ģº2009/12/16 10:30 ʵÏÖ»ù±¾HTTP¸÷ÖÖ½Ó¿Ú²Ù×÷Ö§³Ö
*
************************************************************/
/**
* HTTP¹¦Äܹ¤³§·½·¨Àà
*
* µ÷ÓÃʾÀý´úÂ룺
try {
$http = Http::factory('http://www.baidu.com', Http::TYPE_SOCK );
echo $http->get();
$http = Http::factory('http://127.0.0.1/test/i.php', Http::TYPE_SOCK );
echo $http->post('', array('user'=>'ÎÒÃÇ', 'nick'=>'ASSADF@#!32812989+-239%ASDF'), '', array('aa'=>'bb', 'cc'=>'dd'));
} catch (Exception $e) {
echo $e->getMessage();
}
*/
class Http
{
/**
* @var ʹÓà CURL
*/
const TYPE_CURL = 1;
/**
* @var ʹÓà Socket
*/
const TYPE_SOCK = 2;
/**
* @var ʹÓà Stream
*/
const TYPE_STREAM = 3;


/**
* ±£Ö¤¶ÔÏó²»±»clone
*/
private function __clone() {}
/**
* ¹¹Ô캯Êý
*/
private function __construct() {}
/**
* HTTP¹¤³§²Ù×÷·½·¨
*
* @param string $url ÐèÒª·ÃÎʵÄURL
* @param int $type ÐèҪʹÓõÄHTTPÀà
* @return object
*/
public static function factory($url = '', $type = self::TYPE_SOCK){
if ($type == ''){
$type = self::TYPE_SOCK;
}
switch($type) {
case self::TYPE_CURL :
if (!function_exists('curl_init')){
throw new Exception(__CLASS__ . " PHP CURL extension not install");
}
$obj = Http_Curl::getInstance($url);
break;
case self::TYPE_SOCK :
if (!function_exists('fsockopen')){
throw new Exception(__CLASS__ . " PHP function fsockopen() not support");
}
$obj = Http_Sock::getInstance($url);
break;
case self::TYPE_STREAM :
if (!function_exists('stream_context_create')){
throw new Exception(__CLASS__ . " PHP Stream extension not install");
}
$obj = Http_Stream::getInstance($url);
break;
default:
throw new Exception("http acc


Ïà¹ØÎĵµ£º

php Ŀ¼ºÍÎļþ²Ù×÷

<?php
//н¨Ä¿Â¼
mkdir("/path/to/my/dir", 0700); //0700±íʾȨÏÞ×î´ó
//ɾ³ýĿ¼
rmdir("/path/to/my/dir");
//±éÀúĿ¼
$p =dir(/etc/php5);
echo "handler:".$p->handler;
while(false!=$entry=$p->read()){
    echo $entry."\n" ;
}
$p->close();
//Êä³öÎļþÄÚÈÝ
$handle=@ ......

ÖØÐÂÉóÊÓ PHP ¿ò¼Ü CodeIgniter VS Zend

×÷ÕߣºEkerete
·­Ò룺Emeric Li (http://lee.kometo.com/index.php/archives/117
)
Ô­ÎÄ£ºhttp://www.avnetlabs.com/php/php ... r-vs-zend-framework
ÎÒÃǼƻ®´ÓÍ·¿ªÊ¼Ò»¸öÐÂÏîÄ¿£¬Îª´ËÆÀ¹ÀÁËһЩPHP¿ò¼Ü¡£ÎÒÃǵı¸Ñ¡ÁбíÓÐCakePHP £¬ CodeIgniter £¬ SymfonyºÍZend ¡£ ÎÒÃÇ·Ö±ðʹÓÃÕâ4ÖÖ¿ò¼Ü±àдÁËÒ»¸öÏàͬµÄСӦÓ㨠......

php ÖÐ$_SESSIONµÄÀí½â

       PHPÓкܶàÖµµÃѧϰµÄµØ·½£¬ÕâÀïÎÒÃÇÖ÷Òª½éÉÜPHP SessionʹÓá£ÔÚPHP¿ª·¢ÖжԱÈÆðCookie£¬session ÊÇ´æ´¢ÔÚ·þÎñÆ÷¶ËµÄ»á»°£¬Ïà¶Ô°²È«£¬²¢ÇÒ²»Ïñ Cookie ÄÇÑùÓд洢³¤¶ÈÏÞÖÆ£¬ÏÂÃæÎÒÃǾͼòµ¥½éÉÜ PHP SessionʹÓá£
 
¡¡¡¡ÓÉÓÚ Session ÊÇÒÔÎı¾ÎļþÐÎʽ´æ´¢ÔÚ·þÎñÆ÷¶ËµÄ£¬ËùÒÔ² ......

×Ô¼º±àд»ùÓÚMVCµÄÇáÁ¿¼¶PHP¿ò¼Ü

×Ô¼º±àд»ùÓÚMVCµÄÇáÁ¿¼¶PHP¿ò¼Ü
2008-4-3 23:33:56 Òѱ»ÔĶÁ£º
477 ·¢±íÆÀÂÛ
×öWEB¿ª·¢ÒÑÓÐÒ»Äê,ÿ´Î¶¼Ð´Öظ´µÄ¶«Î÷, Òò´Ë,Ïë×Ô¼ºÐ´Ò»Ï¿ò¼Ü,ÒԺ󿪷¢·½±ã.
±¾ÈË֮ǰѧϰasp.NETÁ½Äê,JSP°ëÄê,¿ÉÊǺóÀ´ÒòΪ¹¤×÷µÄÔ­¹Ê»»³ÉPHP.ÆäʵºÜ²»Ï²»¶PHPµÄÓï·¨.»¹ÓÐPHPµÄº¯ÊýÃû,ÿ»Ø¶¼Íü¼Ç..»¹ÊÇϲ
»¶C#ºÍJAVAµÄÓï·¨,¹þ...²» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ