21¸ö¾³£Óõ½µÄPHPº¯Êý´úÂë¶Î(3)
11. PHPÇ¿ÖÆÐÔÎļþÏÂÔØ
ΪÓû§ÌṩǿÖÆÐÔµÄÎļþÏÂÔع¦ÄÜ¡£
/******************** *@file ¨C path to file */ function force_download($file) { if ((isset($file))&&(file_exists($file))) { header(¡°Content-length: ¡°.filesize($file)); header(¡®Content-Type: application/octet-stream¡¯); header(¡®Content-Disposition: attachment; filename=¡±¡® . $file . ¡®¡±¡®); readfile(¡°$file¡±); } else { echo ¡°No file selected¡±; } }12. PHP´´½¨±êÇ©ÔÆ
function getCloud( $data = array(), $minFontSize = 12, $maxFontSize = 30
)
{
$minimumCount = min( array_values( $data ) );
$maximumCount = max(
array_values( $data ) );
$spread = $maximumCount ¨C
$minimumCount;
$cloudHTML = ¡±;
$cloudTags = array();
$spread == 0 && $spread = 1;
foreach( $data as $tag => $count )
{
$size = $minFontSize + ( $count
¨C $minimumCount )
* ( $maxFontSize ¨C $minFontSize ) /
$spread;
$cloudTags[] = ¡®<a style=¡±font-size: ¡® . floor( $size ) .
¡®px¡¯
. ¡®¡± href=¡±#¡± title=¡±\¡± . $tag .
¡®\¡¯ returned a count of ¡® . $count
. ¡®¡±>¡¯
. htmlspecialchars( stripslashes( $tag ) ) . ¡®</a>¡¯;
}
return join( ¡°\n¡±, $cloudTags ) .
¡°\n¡±;
}
/**************************
**** Sample usage ***/
$arr
= Array(¡®Actionscript¡¯ => 35, ¡®Adobe¡¯ => 22, ¡®Array¡¯ => 44,
¡®Background¡¯ => 43,
¡®Blur¡¯ => 18, ¡®Canvas¡¯ => 33, ¡®Class¡¯ => 15,
¡®Color Palette¡¯ => 11, ¡®Crop¡¯ => 42,
¡®Delimiter¡¯ => 13, ¡®Depth¡¯
=> 34, ¡®Design¡¯ => 8, ¡®Encode¡¯ => 12, ¡®Encryption¡¯ =>
30,
¡®Extract¡¯ => 28, ¡®Filters¡¯ => 42);
echo getCloud($arr, 12,
36);
13. PHPÑ°ÕÒÁ½¸ö×Ö·û´®µÄÏàËÆÐÔ
PHP ÌṩÁËÒ»¸ö¼«ÉÙʹÓÃµÄ similar_text º¯Êý£¬µ«´Ëº¯Êý·Ç³£ÓÐÓã¬ÓÃÓڱȽÏÁ½¸ö×Ö·û´®²¢·µ»ØÏàËƳ̶ȵİٷֱȡ£
similar_text($string1, $string2, $percent); //$percent will have the percentage of similarity
14. PHPÔÚÓ¦ÓóÌÐòÖÐʹÓà Gravatar ͨÓÃÍ·Ïñ
Ëæ×Å WordPress Ô½À´Ô½ÆÕ¼°£¬Gravatar Ò²ËæÖ®Á÷ÐС£ÓÉÓÚ Gravatar ÌṩÁËÒ×ÓÚʹÓÃµÄ API£¬½«ÆäÄÉÈëÓ¦ÓóÌÐòÒ²±äµÃÊ®·Ö·½±ã¡£
/****************** *@email ¨C Email address to show gravatar for *@size ¨C size of gravatar *@default ¨C URL of default gravatar to use *@rating ¨C rating of Gravatar(G, PG, R, X) */ function show_gravatar($email, $size, $default, $rating) { echo ¡®<img src=¡±http://www.gravatar.com/avatar.php?gravatar_id=¡¯.md5($email). ¡®&default=¡¯.$default.¡¯&size=¡¯.$size.¡¯&rating=¡¯.$rating.¡¯¡± width=¡±¡®.$size.¡¯px¡± height=¡±¡®.$size.¡¯px¡± />¡¯; }
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿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¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ