AJAXÖÐÎÄÂÒÂëPHPÍêÃÀ½â¾ö
×î½üÔÚ×öÒ»¸öÏîÄ¿£¬Óöµ½AJAXÖÐÎÄÂÒÂëÎÊÌ⣬¾¹ýÒ»¸öÏÂÎçµÄŬÁ¦ÖÕÓÚÍêÃÀ½â¾ö£¬ÏÖ½«ÐĵÃдÏÂÀ´£¬Ï£Íû¶ÔÄÇЩ»¹À§ÈÆÔÚÕâ¸öÎÊÌâ¶øÍ·Í´²»ÒѵÄÈËÃÇÓÐËù°ïÖú¡£
ÖÚËùÖÜÖª£¬Ê¹ÓÃAJAX´«ËͺͽÓÊÕÖÐÎIJÎÊýʱ£¬Èç¹û²»ÔÚ¿Í»§¶ËºÍ·þÎñÆ÷×öÏàÓ¦µÄ´¦Àí¾Í»á³öÏÖÂÒÂëÎÊÌ⣬ÔÚÍøÉÏÏàÓ¦µÄÎÄÕÂÒ²²»ÉÙ£¬µ«ÊÇÓеÄÇé¿öϺÜÄÑ´ÓÖÐÕÒµ½·ûºÏ×Ô¼ºÀíÏëµÄ´ð°¸£¬ÎÒ½ñÌì¾ÍÊÇÔÚÍøÉÏÕÒÁ˺ܶ࣬µ«ÊǶ¼²î²»¶à£¬½²ASPºÍJSPµÄ±È½Ï¶à£¨ÎÒÊÇÓõÄPHP£©£¬ËùÒÔµ½×îºó¶¼Ã»ÕÒµ½×Ô¼ºÂúÒâµÄ´ð°¸¡£
AJAXµÄÖÐÎÄÂÒÂë¿ÉÒÔ´ó¸Å·ÖΪÁ½ÖУ¬µÚÒ»ÖÖÊÇÏò·þÎñÆ÷¶Ë·¢ËÍÖÐÎIJÎÊýʱ£¨xmlhttp.open(“get|post”,url,true)£©,·þÎñÆ÷¶Ë½ÓÊÕµ½µÄΪÂÒÂ룬Õâ¸öÒ²ÊÇÎÒ½ñÌìÓöµ½µÄÎÊÌ⣬û×ö´¦Àí֮ǰ£¬ÔÚIEÀïÊÇÕý³£µÄ£¬µ«ÊÇÔÚFirefoxÀïÃæ¾Í³öÏÖÁËÂÒÂ룬ÎÒÏȰѽÓÊÕµ½²ÎÊýÊä³öµ½Ò»¸öÎı¾ÀûÓз¢ÏÖʲôÎÊÌ⣬ÓôÃÆÁË£¬È»ºóÎҾͰѲéѯÓï¾äÔÚÊä³öÀ´¹Û²ì£¨ÎÒÕâÀïÊÇÒª´ÓÊý¾Ý¿âÀï²é³öÓë²ÎÊýÏà¹ØµÄ¶«Î÷£©£¬ÖÕÓÚ·¢ÏÖÎÊÌ⣬IEºÍFirefoxÊä³öµÄ²ÎÊý²»Ò»Ñù£¬ËäÈ»ºº×ÖÉ϶¼Ò»Ñù£¬µ«ÊǺÍÇ°ºóÁ¬½ÓÉÏÓÐϸСµÄÇø±ð£¬ÓÚÊÇÈ϶¨ÁËÊDZàÂëÎÊÌ⣬ÔÚÍøÉϲéÕÒÁËÏà¹Ø×ÊÁÏ£¬¶¼Ã»Äܽâ¾öÎÊÌ⣬µ«Êǵõ½Ò»Ð©Æôʾ£¬ÒòΪAJAX·¢ËÍÊý¾Ý¶¼ÊDzÉÓÃUTF-8±àÂëµÄ·½Ê½·¢Ë͵ģ¬ËùÒÔÒªÔÚ·þÎñÆ÷¶Ë½øÐбàÂëת»»£¨ÎÒÕâÀïÒ³ÃæÊDzÉÓÃGB2312±àÂëµÄ£¬Èç¹ûÊDzÉÓÃUTF-8µÄ»°Ó¦¸Ã²»»áÓÐÕâ²½µÄÎÊÌ⣩£¬ËùÒÔÎÒÔÚ·þÎñÆ÷¶Ë½øÐÐÁËUTF-8תGB2312£¬
$str=iconv("UTF-8","GB2312",$str);
È»ºó²âÊÔ£¬ÔÚFirefoxÉÏ˳Àû½â¾öÁËÎÊÌ⣬ÒÔΪ´ó¹«¸æ³ÉÁË£¬¿ÉÊÇÔÙµ½IEϲâÊÔ£¬·¢ÏÖIEÓÖ³öÏÖÁËÎÊÌ⣬·þÎñÆ÷¶Ë½ÓÊÕµ½µÄ²ÎÊýûֵ£¬ÕâϾÍÓôÃÆÁË£¬Í»È»¿´µ½·¢ËÍÍ·ÉèÖÃÁËsetRequestHeader("Content-Type","application/x-www-form-urlencoded");£¬¾ÍÕÒµ½ÎÊÌâËùÔÚÁË£¬È»ºó¾ÍÔÚ·¢ËÍÄÇÀï½øÐÐÁ˲ÎÊý±àÂ룺
geturl=encodeURI(geturl);
geturl=encodeURI(geturl); //Á½´ÎÒ²¿ÉÒÔд³Égeturl=encodeURI(encodeURI(geturl));
xmlhttp.open("GET",geturl,true);
È»ºóÔÙµ½·þÎñÆ÷¶Ë½øÐÐURL½âÂ룺
$str=urldecode($str); //½âÂë
$ str =iconv("UTF-8","GB2312",$ str); //±àÂëת»»
×¢Ò⣺½âÂë±ØÐëÔÚ±àÂëת»»Ç°Ã棬²»È»µÃ²»µ½ÕýÈ·Öµ
±£´æ²âÊÔ£¬IEºÍFirefox¶¼ÄÜÕý³£ÁË¡£
µÚ¶þÖÖ¾ÍÊÇ·þÎñÆ÷¶ËÏò¿Í»§¶ËÊä³öÖÐÎÄʱ³öÏÖÂÒÂ룬ÕâÀàÎÊÌâÍøÉϵĴ𰸾ͱȽ϶àÁË£¬Ò²¶¼Äܽâ¾ö£¬ÎªÁ˱ÜÃâ¸÷λÔÙÈ¥²éÕÒ£¬ÎÒÔÚÕâÀï¾ÍCOPYÏÂJ
ÔÒò£ºAJAXÔÚ½ÓÊÕresponseText
Ïà¹ØÎĵµ£º
Show All 1 2 3 4 5
±¾ÎÄÓÉMichaelÔ´´ºÍÕûÀí£¬×ªÔØÇë±£Áô³ö´¦£¡http://www.toplee.com/blog/?p=100
Trackback URL: http://www.toplee.com/blog/wp-trackback.php?p=100
¶ÔÓÚ±¾ÎÄÖгöÏֵĴíÎóµ¼ÖÂÄúµÄËðʧ£¬Michael²»³Ðµ£ÔðÈΡ£
Ç°Ò»¶Îʱ¼äÍê³ÉÁË·þÎñÆ÷´ÓFreeBSD4.10µ½6.1µÄÉý¼¶£¬Í¬Ê±°ÑPHPÒ²Éý¼¶µ½ÁË×îÐ嵀 ......
±È½ÏPHPºÍJSPÕâÁ½¸öWeb¿ª·¢¼¼Êõ,ÔÚÄ¿Ç°µÄÇé¿öÊÇÆäʵÊDZȽÏPHPºÍJavaµÄWeb¿ª·¢.ÒÔÏÂÊÇÎҾͼ¸¸öÖ÷Òª·½Ãæ½øÐеıȽÏ:
Ò». ÓïÑԱȽÏ
PHPÊǽâÊÍÖ´ÐеķþÎñÆ÷½Å±¾ÓïÑÔ,Ê×ÏÈphpÓмòµ¥ÈÝÒ×ÉÏÊÖµÄÌصã.Óï·¨ºÍcÓïÑԱȽÏÏó,ËùÒÔѧ¹ýcÓïÑԵij ......
¹úÍâµÄ¿ªÔ´¼¼ÊõÒ²Ó°ÏìºÍÍƶ¯Á˹úÄÚ¿ªÔ´³ÌÐòµÄ·¢Õ¹,¹úÍâÓÅÐ㿪ԴPHP½¨Õ¾³ÌÐòÒ»ÀÀÖÐ,ºÜ¶à¹úÍ⿪Դ³ÌÐò²¢²»Ì«·ûºÏÖйúÈ˵ÄʹÓÃÏ°¹ß,¶ø¹úÄÚÓÐһЩ³§¼Ò»ò¸öÈËÒ²×öÁËһЩ²»´íµÄ²úÆ·,²»ÉÙ³ÌÐòÊÇÌṩԴ´úÂëÏÂÔصÄ,ËäÈ»ÓÐЩÔÚÐí¿ÉÐÒéÉϺͿªÔ´Ðí¿ÉÖ¤ÓÐЩ³öÈë,µ«ÆäÔÚʹÓÃÉÏ»¹ÊÇͦ·ûºÏÖйúÈ˵ÄʹÓÃÏ°¹ß,½ñÌìÎҾͽéÉÜһЩ¹úÄÚµÄPHP&rdqu ......
1£ºsmarty »º´æµÄÅäÖÃ
Php´úÂë
$smarty->cache_dir = "/caches/"; //»º´æĿ¼
$smarty->caching = true; //¿ªÆô»º´æ,ΪflaseµÄʱºî»º´æÎÞЧ
$smarty->cache_lifetime = 60; //»º´æʱ¼ä
2:smarty»º´æµÄʹÓúÍÇå³ý
Php´úÂë
$smarty->di ......
//±éÀúĿ¼¼°Îļþ
function get_all_files( $path )
{
$list = array();
foreach( glob( $path . '/*') as $item )
{
& ......