PHP ×Ö·û´®½ØÈ¡
<?php
//$str = "abcdef¡ôÖлªÈËÃñ¹²ºÍ¹ú";
//$str = "1234567890";
$str = "ÖлªÈËÃñ¹²ºÍ¹úabcÖлªÈËÃñ¹²ºÍ¹úÖлªÈËÃñ¹²ºÍ¹ú";
$str = cut_str($str, 18);
echo $str;
function cut_str($str, $len){
if(strlen($str) <= $len) return $str;
$n = 0;
$tempstr = '';
for($i = 0; $i < $len; $i++){
if(ord(substr($str,$n,1)) > 224){
$tempstr .= substr($str,$n,3);
$n += 3;
$i++;//°ÑÒ»¸öÖÐÎÄ°´Á½¸öÓ¢Îĵij¤¶È¼ÆËã
}elseif(ord(substr($str,$n,1)) > 192){
$tempstr .= substr($str,$n,2);
$n += 2;
$i++;//°ÑÒ»¸öÖÐÎÄ°´Á½¸öÓ¢Îĵij¤¶È¼ÆËã
}else{
$tempstr .= substr($str,$n,1);
$n++;
}
}
return $tempstr."...";
//ÔÚPHPÖУ¬ÓÃsubstr()º¯Êý½ØÈ¡´øÓÐÖÐÎÄ×Ö·û´®µÄ»°£¬¿ÉÄÜ»á³öÏÖÂÒÂ룬ÕâÊÇÒòΪÖÐÎ÷ÎÄÒ»¸ö×ÖËùÕ¼ÓеÄ×Ö½ÚÊý²»Ò»Ñù£¬¶øsubstrµÄ³¤¶ÈÊÇ°´ÕÕ×Ö½ÚÈ¥ËãµÄ£¬ÔÚGB2312±àÂëʱ£¬Ò»¸öÖÐÎÄÕ¼2¸ö×Ö½Ú£¬Ó¢ÎÄΪ1¸ö×Ö½Ú£¬¶øÔÚUTF-8±àÂëµ±ÖУ¬Ò»¸öÖÐÎÄ¿ÉÄÜÕ¼ÓÐ2¸ö»ò3¸ö×Ö½Ú£¬Ó¢ÎÄ»ò°ë½Ç±êµãÕ¼1¸ö×Ö½Ú¡£
//UTF-8±àÂëµÄ×Ö·û¿ÉÄÜÓÉ1~3¸ö×Ö½Ú×é³É£¬¾ßÌåÊýÄ¿¿ÉÒÔÓɵÚÒ»¸ö×Ö½ÚÅжϳöÀ´£¨ÀíÂÛÉÏ¿ÉÄܸü³¤£¬µ«ÕâÀï¼ÙÉè²»³¬¹ý3¸ö×Ö½Ú£©
//µÚÒ»¸ö×Ö½Ú´óÓÚ224µÄ£¬ËüÓëËüÖ®ºóµÄ2¸ö×Ö½ÚÒ»Æð×é³ÉÒ»¸öUTF-8×Ö·û¡£
//µÚÒ»¸ö×Ö½Ú´óÓÚ192СÓÚ224µÄ£¬ËüÓëËüÖ®ºóµÄ1¸ö×Ö½Ú×é³ÉÒ»¸öUTF-8×Ö·û
//·ñÔòµÚÒ»¸ö×Ö½Ú±¾Éí¾ÍÊÇÒ»¸öÓ¢ÎÄ×Ö·û£¨°üÀ¨Êý×ÖºÍһС²¿·Ö±êµã·ûºÅ£©
//OK £¬ÖªµÀ´ó¸ÅµÄÈý¸ü£¬½â¾öÆðÀ´¾ÍÇáËɶàÁË£¬ÓÚÊÇдÏÂÁËÒÔϺ¯ÊýÓÃÓÚUTF-8µÄ×Ö·û½ØÈ¡£º
//PHPÒ²ÓÐ×Ô´øµÄº¯Êý¿ÉÒÔÓÃÓÚ²»Í¬±àÂëµÄ×Ö·û´®½ØÈ¡£¬Èçmb_substr()£¬µ«ÒªÔÚphp.iniÖпªÆôÏàÓ¦µÄÀ©Õ¹¡£
}
?>
Ïà¹ØÎĵµ£º
ÔÚFlexÖÐÓÐ2¸öHTTPServiceÀ࣬ËüÃǵÄÍêÕû¼Ì³Ð·¾¶·Ö±ðÊÇmx.rpc.httpºÍmx.rpc.http.mxml,¿ÉÒÔ¿´³ömx.rpc.http.mxmlÊÇmx.rpc.httpµÄ×ÓÀà¡£mx.rpc.http.mxmlÖеÄhttpServiceÖ÷ÒªÊÇΪÁËMXML±êÇ©ÖÐʹÓÃHTTPService¶øÉèµÄ¡£mx.rpc.httpÊÇÔÚʹÓÃas½Å±¾½øÐвÙ×÷ʱʹÓᣵ±µ÷Óà HTTPService ¶ÔÏóµÄ send() ·½·¨Ê±£¬½«·¢³ö¶ÔÖ¸¶¨ URL ......
Èç¹û²»¾ß±¸ÐÞ¸Äphp.iniµÄȨÏÞ£¬¿ÉÒÔÈçÏ£º
ini_set("display_errors", "On");
error_reporting(E_ALL | E_STRICT);
µ±È»£¬Èç¹ûÄܹ»ÐÞ¸Äphp.iniµÄ»°£¬Èçϼ´¿É£º
display_errors = On
error_reporting = E_ALL & ~E_NOTICE ......
<?php
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=php100.xls");
/* echo "A1\t B1\t C1\n";
echo "A1\t B1\t C1\n";
echo "A1\t B1\t C1\n";
*/
?>
<!--*********************************************±¨±í***************************************** ......
±¾À´²»Ïë̸Õâ¸ö³ÁÖصĻ°Ì⣬Æäʵ˵°×ÁË£¬Èç¹ûÄãÒ»¸öPHPµÄ³ÌÐòÔ±Á¬ÔõôÅäÖû·¾³¶¼¸ã²»¶¨Ä㻹¸ã¸öP¿ª·¢Ñ½¡£µÃ£¬ÔÛ²»ËµÄãÔÚlinuxÏÂÃæ¸ã¶¨ÕâЩ£¬ÄѵÀÄãÔÚwindowsÏÂÃæÄãÒ²¸ã²»¶¨£¿
ÏÖÔÚµÄPHP¶þ½øÖÆ°²×°°æ±¾ÒѾ¿ÉÒÔÖ§³Öapache,iis5,iis6µÈһЩWEB·þÎñÆ÷ÁË£¬ÎªÊ²Ã´»¹ÊÇÓÐһЩÈ˲»»áÅäÖÃÄØ£¿ÕæÏ벻ͨѽ¡£¡£¡£¡£¡£¡£
ÓÚÊÇÔÚÕâÖÖ´ó ......
¡¡¡¡×î½üÔÚ×ö¸öÒ³Ãæʱ£¬Óöµ½ÒªPHP³ÌÐòÖÐʵÏÖÑÓ³Ùµ±Ç°½ø³ÌÎÊÌâ¡£ÓÉÓÚ½Ó´¥PHPʱ¼äÓÐÏÞ£¬Ï뵱ȻµÄÈÏΪPHPÖÐʵÏִ˹¦Äܵĺ¯ÊýÒ²ÊÇsleep()¡£ÊÂʵÉÏ£¬ÔÚPHPÖеÄÈ·ÓÐÕâ¸öº¯Êý£¬µ«ÔÚÎÒ³¢ÊÔÁË°ëÌìºó£¬È´Ê¼ÖÕ²»ÄÜʵÏÖÎÒÒªµÄÂß¼¡£PHP5ÊÖ²áÖУ¬¶ÔÕâ¸öº¯ÊýÊÇÕâÑùÃèÊöµÄ£ºsleep -- Delay execution¡£µ±ÎÒ°Ù¶ÈÁËÒԺ󣬲ÅÖªµÀÕ⸠......