PHP×Ö·ûº¯Êý´óÈ«µÚ1/2Ò³

5年以前  |  阅读数:488 次  |  编程语言:PHP 

AddSlashes: ×Öu´®¼ÓÈeбÏß¡£
bin2hex: ¶þ½øλת³ÉÊ®Áu½øλ¡£
Chop: È¥³ýÁ¬Ðø¿Õ°×¡£
Chr:
µ»ØÐoÊýÖµµÄ×Öu¡£
chunk_split: ½«×Ö
u´®Ö³ÉС¶Î¡£
convert_cyr_string: ת»»¹Å˹À­
o×Öu´®³ÉÆaËu×Öu´®¡£
crypt: ½«×Öu´®Óà DES ±aÂe¼ÓÃÜ¡£
echo: Êa³o×Ö
u´®¡£
explode: Çпª×Öu´®¡£
flush: Ça³oÊa³o»º³aÇø¡£
get_meta_tags: ³e³oÎļþËuÓÐ meta ±e¼ÇµÄ×ÊÁÏ¡£
htmlspecialchars: ½«ÌØÊa×Ö
uת³É HTML ¸ñʽ¡£
htmlentities: ½«ËuÓеÄ×Öu¶¼×ª³É HTML ×Öu´®¡£
implode: ½«Êý×e±a³É×Öu´®¡£
join: ½«Êý×e±a³É×Ö
u´®¡£
ltrim: È¥³ýÁ¬Ðø¿Õ°×¡£
md5: ¼ÆËa×Öu´®µÄ MD5 ¹þÏ¡¡£
nl2br: ½«»»ÐÐ×Ö
uת³É
¡£
Ord: µ»Ø×ÖuµÄÐoÊýÖµ¡£
parse_str: ½aÎo query ×Öu´®³É±aÁ¿¡£
print: Êa³o×Ö
u´®¡£
printf: Êa³o¸ñʽ»¯×Öu´®¡£
quoted_printable_decode: ½« qp ±aÂe×Ö
u´®×ª³É 8 λ×Öu´®¡£
QuoteMeta: ¼ÓÈeÒýÓÃ
uºÅ¡£
rawurldecode: ´Ó URL רÓøñʽ×Öu´®»¹Ô­³ÉÆÕͨ×Öu´®¡£
rawurlencode: ½«×Öu´®±aÂe³É URL רÓøñʽ¡£
setlocale: ÅaÖõØÓo»¯ÐÅÏ¢¡£
similar_text: ¼ÆËa×Ö
u´®ÏaËƶȡ£
soundex: ¼ÆËa×Öu´®µÄ¶ÁÒoÖµ
sprintf: ½«×Ö
u´®¸ñʽ»¯¡£
strchr: Ñ°ÕÒµÚÒ»¸o³oÏÖµÄ×Öu¡£
strcmp: ×Ö
u´®±È½Ï¡£
strcspn: ²»Í¬×Öu´®µÄ³¤¶È¡£
strip_tags: È¥µo HTML ¼° PHP µÄ±e¼Ç¡£
StripSlashes: 鴵o
´Ð±Ïß×Öu¡£
strlen: È¡µÃ×Ö
u´®³¤¶È¡£
strrpos: Ñ°ÕÒ×Öu´®ÖÐij×Öu×iºo³oÏÖ´¦¡£
strpos: Ñ°ÕÒ×Öu´®ÖÐij×Öu×iÏȳoÏÖ´¦¡£
strrchr: È¡µÃij×Öu×iºo³oÏÖ´¦ÆðµÄ×Öu´®¡£
strrev: µßµ¹×Öu´®¡£
strspn: ÕÒ³oij×Ö
u´®ÂaÔÚÁiÒ»×Öu´®ÕÚÕÖµÄÊýÄ¿¡£
strstr:
µ»Ø×Öu´®ÖÐij×Öu´®¿ªÊ¼´¦ÖÁ½aÊøµÄ×Öu´®¡£
strtok: Çпª×Ö
u´®¡£
strtolower: ×Öu´®È«×ªÎªÐ¡Ð´¡£
strtoupper: ×Ö
u´®È«×ªÎª´oд¡£
str_replace: ×Öu´®È¡´u¡£
strtr: ת»»Ä³Ð(C)×Ö
u¡£
substr: È¡²¿Ý×Öu´®¡£
trim: ½ØÈ¥×Öu´®Ê×βµÄ¿Õ¸ñ¡£
ucfirst: ½«×Ö
u´®µÚÒ»¸o×Öu¸Ä´oд¡£
ucwords: ½«×Ö
u´®Ã¿¸o×ÖµÚÒ»¸o×Öĸ¸Ä´oд¡£

µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯ÊýʹÐeÒªÈÃÊý¾Ý¿a´¦ÀiµÄ×Öu´®£¬ÒýºÅµÄ²¿Ý¼ÓÉÏбÏߣ¬ÒÔ¹(C)Êý¾Ý¿a²eѯ (query) ÄÜ˳ÀuÔË×÷¡£ÕaÐ(C)»a±»¸ÄµÄ×Öu°uÀ¨µ¥ÒýºÅ (')¡¢Ë«ÒýºÅ (")¡¢´Ð±Ïß backslash (\) ÒÔ¼°¿Õ×Ö*u NUL (the null byte)¡£
²Î¿¼: stripslashes() htmlspecialchars() quotemeta()

µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯ÊýÈöþ½øλ×Öu´®×ª³ÉÊ®Áu½øλ×Öu´®¡£
ʹÓÃ*¶Àý
²¹³a:
josh@superfork.com (22-Jun-1999) дÁËÒ»¸oº¯Êý£¬¿É½«Ê®Áu½øλת³É¶þ½øλ¡£
<?
function hex2bin($data) {
$len = strlen($data);
for($i=0;$i<$len;$i+=2) {
$newdata .= pack("C",hexdec(substr($string,$i,2)));
}
return $newdata;
}
?>

µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½«×Öu´®µÄÁ¬Ðø¿Õ°×Ça³ý¡£
ʹÓÃ
¶Àý
<?
$trimmed = Chop($line);
?>
²Î¿¼: trim()

µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½«×ÖuµÄÐoÊýת³É ASCII µÄ×Öu¡£±¾º¯ÊýºÍ ord() ³É¶ÔÕÕ¡£
ʹÓöÀý
<?
$str .= chr(27);
$str = sprintf("×Ö
u´®µÄ½aÊø×Ö*uÊÇ: %c", 27);
?>
²Î¿¼: ord() sprintf()

µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½«×Öu±a³ÉС¶Î¹(C)ÆaËuº¯ÊýʹÓá£ÀýÈ磬base64_encode¡£ÄÚ¶¨ÊDzÎÊý chunklen (76 ¸o×Öu) ÿ¸o 76 ¸o×Öu²aÈe end ("\r\n")¡£µ»ØÐÂ×Öu´®¶ø²»¸Ä¶¯Ô­×Öu´®¡£
ʹÓöÀý
½«×Ö
u´® $data ¸ñʽ»¯³É MIME BASE64 ¸ñʽ
<?
$new_string = chunk_split(base64_encode($data));
?>
²Î¿¼: ereg_replace()

µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½«¹Å˹À­o×Öu´®×ª³ÉÆaËuµÄ×Öu´®¡£from ¼° to ¶þ¸o²ÎÊýÊÇ×Öu£¬Æa´u±iÒaÒaÈçÏ£º
k - koi8-r
w - windows-1251
i - iso8859-5
a - x-cp866
d - x-cp866
m - x-mac-cyrillic

Ói¨: string crypt(string str, string [salt]);
µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ±aÂe´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½«×Ö
u´®Óà UNIX µÄ±e×¼¼ÓÃÜ DES Ä£¿e¼ÓÃÜ¡£ÕaÊǵ¥ÏoµÄ¼ÓÃܺ¯Êý£¬ÎÞ¨½aÃÜ¡£Óu±È¶Ô×Öu´®£¬½«ÒѼÓÃܵÄ×Öu´®µÄͶþ¸o×ÖuÅÔÚ salt µÄ²ÎÊýÖУ¬ÔٱȶԼÓÃܺoµÄ×Öu´®¡£
¸uÏeϸµÄ×ÊÁÏÇe²Î¿¼ UNIX Manual (man) ÖÐµÄ crypt¡£
ÔÚÒ»Ð(C)½ÏÐ嵀 UNIX °ae±¾ÖУ¬³ýÁË DES Ö®Ía»¹Ìa¹(C)ÁËÆaËuµÄ¼ÓÃÜÄ£¿e£¬Èç MD5¡£ÉoÖÁÓÐÐ(C)ϵͳ»¹Óà MD5 È¡´u DES¡£ÔÚ salt ²ÎÊý»¹ÓÐÒ»Ð(C)±a»¯£¬¶Ë¿´´«¸ø salt ²ÎÊýµÄ×Ö
u´®³¤¶È¶ø¶¨£º
CRYPT_STD_DES - ±e×¼µÄ DES ±aÂe£¬ÊaÈe 2 ×ÖuµÄ salt¡£
CRYPT_EXT_DES - ÑÓÉiµÄ DES ±aÂe£¬ÊaÈe 9 ×Ö
uµÄ salt¡£
CRYPT_MD5 - MD5 ±aÂe£¬ÊaÈe 12 ×Öu¼ÓÉÏ $1$ µÄ salt¡£
CRYPT_BLOWFISH - ÑÓÉiµÄ DES ±aÂe£¬ÊaÈe 16 ×Ö
u¼ÓÉÏ $2$ µÄ salt¡£
´ËÍa£¬Èo²»Ê¹Óà salt ²ÎÊý£¬Ôo³ÌÐo»a×Ô¶¯²uÉu¡£

µ»ØÖµ: ÎÞ
º¯ÊýÖÖÀa: PHP ϵͳ¹¦ÄÜ
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½«×Ö
u´®Êa³o¡£ÓÉÓÚËu²»ÊÇÕaeÕýµÄº¯Êý£¬Òo´ËҲûÓе»ØÖµ¡£
ʹÓÃ
¶Àý
<?php
echo "Hello World";
?>
²Î¿¼: print() printf() flush()

µ»ØÖµ: Êý×e
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½«×Ö
u´®ÒÀÖ¸¶¨µÄ×Öu´®»o×Öu separator Çпª¡£½«ÇпªºoµÄ×Öu´®µ»Øµ½Êý×e±aÁ¿ÖС£
ʹÓÃ*¶Àý
<?
$pizza = "µÚһƬ µÚ¶þƬ µÚÈýƬ µÚËÄƬ µÚÎaƬ µÚÁuƬ";
$pieces = explode(" ", $pizza);
?>
²Î¿¼: implode()

*µ»ØÖµ: ÎÞ
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯ÊýÎÞÊaÈeÒaÎÞÊa³o¡£½«Êa³o»º³aÇøµÄ×ÊÁÏËͳo£¬²¢Ça³o¡£

Ói¨: array get_meta_tags(string filename, int [use_include_path]);
µ»ØÖµ: Êý×e
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½« homepage ÖеÄËuÓÐ <meta ......> ±e¼ÇµÄ×ÊÁÏÈ¡³o²¢ÅÖÃÊý×e±aÁ¿µ»Ø¡£ÀýÈç

PHP BIBLE ±¾º¯ÊýÕÒ³o meta ±e¼Ç£¬name ÊoÐÔµÄ×Ö*u´®ÎªÊý×eË÷Òý£¬¶ø content ÊoÐÔ×Ö*u´®ÔoΪÊý×eµÄÄÚÈÝ×ÊÁÏÁË¡£ÖÎļþÃ×¢ÒaµÄÊDZ¾º¯ÊýΪ PHP Ô­Éuº¯Êý£¬ÔÚ UNIX ϵÁÐƽ̨ÉÏÎÞ*¨Ö±½Ó´¦ÀiÂo½ðËþµÄÎļþ¸ñʽ£¬ÒoΪ»»ÐÐ×Ö*u²»Í¬¡£blake@mediaone.net Ö¸³o (07-Jun-1999)£¬²ÎÊý filename Ò²¿ÉÒÔÊÇ URL£¬º¯Êý½«³e³oÔ¶¶Ë*þÎñÆ÷µÄÎļþ meta ±e¼Ç¡£¶øº¯ÊýÔÚ´¦Àiʱ£¬Óoµ½ ±e¼Ç½aÊø£¬ÒªÊÇ ±e¼Ç*ÅÔÚ ºo½«ÎÞ*¨´¦Ài¡£

Ói¨: string htmlspecialchars(string string);
µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½«ÌØÊa×Ö
uת³É HTML µÄ×Ö*u´®¸ñʽ ( &....; )¡£×i³£Óõ½µÄ³¡ºÏ¿ÉÄܾÍÊÇ´¦Ài¿Í»§ÁoÑÔµÄÁoÑÔ°aeÁË¡£
& (ºÍ) ת³É &
" (Ë«ÒýºÅ) ת³É "
< (СÓÚ) ת³É <

(´oÓÚ) ת³É >
´Ëº¯Êýֻת»»ÉÏÃaeµÄÌØÊa×Öu£¬²¢²»»aÈ«²¿×ª»»³É HTML Ëu¶¨µÄ ASCII ת»»¡£
ʹÓÃ
¶Àý
ÕaÊÇ aulbach@unter.franken.de (27-Jan-1999) ËuÌa¹(C)µÄ*¶Àý

Restaurant Description

Name of restaurant:
ÊaÈeÃeÊo (ÈoÄu»a HTML£¬¿ÉÖ±½ÓʹÓÃ):
²Î¿¼: htmlentities() nl2br()

Ói¨: string htmlentities(string string);
µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯ÊýÓеaÏñ htmlspecialchars() º¯Êý£¬µ«±¾º¯Êý»a½«ËuÓÐ string µÄ×Ö
u¶¼×ª³É HTML µÄÌØÊa×Ö¼¯×Öu´®¡£²»¹ýÔÚת»»ºoÔĶÁÍøÒ³Ô´´uÂeµÄ½Ãae£¬»aÓкܶaÀ§ÈÅ£¬ÓÈÆaÊÇÍøÒ³Ô´´uÂeµÄÖÐÎÄ×Ö»a±aµÃ²»ÖªËuÔÆ£¬a¯ÀÀÆ÷ÉÏ¿´µ½µÄ»¹ÊÇÕý³£µÄ¡£

µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½«Êý×eµÄÄÚÈÝ×eºÏ³ÉÒ»¸o×Öu´®£¬²ÎÊý glue ÊÇ×ÖÖ®¼aµÄÖ¸ouºÅ¡£
ʹÓÃ
¶Àý
<?
$colon_separated = implode(":", $array);
echo $colon_separated;
?>
²Î¿¼: explode() join() split()

µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯ÊýÊÇ implode º¯ÊýµÄ±ðÃu¡£

µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯ÊýÓÃÀ´É¾È¥×Ö*u´®ÖеÄÁ¬Ðø¿Õ°×´ø (whitespace)¡£

Ói¨: string md5(string str);
µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ±aÂe´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯ÊýÓÃÀ´¼ÆËa MD5 ¹þÏ¡¡£¹ØÓÚ MD5 ±aÂe
¨£¬¿ÉÒԲο¼ RSA Data Security, Inc. MD5 Message-Digest Algorithm. RFC1321£»»oÊÇÀµÏªËÉ¡¢º«ÁÁ¡¢ÕÅÕae³ÏµÈºÏ×ÅÖ®½u´uÃÜÂeѧ¼°ÆaÓ¦Óã¬11.3¡£

Ói¨: string nl2br(string string);
µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½«»»ÐÐ×Ö
uת»»³É HTML »»ÐеÄ
Ö¸Ái¡£
²Î¿¼: htmlspecialchars() htmlentities()

µ»ØÖµ: ÕuÊý
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý
µ»Ø×ÖuµÄ ASCII (ÃÀ¹u¹u¼Ò±e×¼½»»»Âe) ÐoÊýÖµ¡£±¾º¯ÊýºÍ chr() º¯ÊýÏa´¡£
ʹÓöÀý
<?php
if (ord($str) == 10) {
echo("×Ö
u´® \$str µÄµÚÒ»¸o×ÖÊÇ»»ÐÐ×Ö*u¡£\n");
}
?>
²Î¿¼: chr()

Ói¨: void parse_str(string str);
µ»ØÖµ: ÎÞ
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý¿É½«a¯ÀÀÆ÷µ»ØµÄ GET ½¨µÄ QUERY_STRING ×Öu´®½aÎo¡£µ»ØµÄ±aÁ¿Ãu¼°Öµ¾ÍÒÀ QUERY_STRING µÄÃu³Æ¼°Öµ¡£
ʹÓÃ
¶Àý
<?php
$str = "first=value&second;[]=this+works&second;[]=another";
parse_str($str);
echo $first; // ÏÔʾ³o "value" ×Öu´®
echo $second[0]; // ÏÔʾ "this works" ×Ö
u´®
echo $second[1]; // ÏÔʾ "another" ×Ö*u´®
?>

µ»ØÖµ: ²¼¶uÖµ
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯ÊýÊa³o×Ö
u´®¡£Èo³É¹¦Ôoµ»Ø 1£¬Ê§°ÜÔoµ»Ø 0¡£ÀýÈç´«ÊaÖÐ;¿Í»§µÄa¯ÀÀÆ÷ͻȻ¹ÒÁË£¬Ôo»aÔi³ÉÊa³oʧ°ÜµÄÇeÐΡ£
²Î¿¼: echo() printf() flush()

µ»ØÖµ: ÕuÊý
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯ÊýÒÀ²ÎÊý format Ö¸¶¨µÄÄÚÈݸñʽ½«×Ö
u´®¸ñʽ»¯¡£¸ñʽµÄϸ½Ú¿ÉÒԲο¼ sprintf()¡£
²Î¿¼: print() sprintf() flush()

Ói¨: string quoted_printable_decode(string str);
µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ±aÂe´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý¿ÉÒÔ½« quoted-printable ºoµÄ×Ö
u´®½aÂe³ÉΪ 8 λ±aÂeµÄ×Öu´®¡£¶ø±¾º¯ÊýÀaËÆ imap_qprint() º¯Êý£¬Ö»Ò»²»Í¬µÄµØ½ÊÇʹÓà imap_qprint() º¯ÊýÐeÒªÈÃϵͳ¼ÓÈe IMAP µÄÄ£¿e£¬¶ø±¾º¯Êý²»ÐeÒª IMAP Ä£¿e¡£

µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ×ÊÁÏ´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½«×Öu´®Öк¬ÓÐ . \\ + ? [ ^ ] ( $ ) µÈ×ÖuµÄÇ°Ãae¼ÓÈe´Ð±Ïß "\" *uºÅ¡£
²Î¿¼: addslashes() htmlentities() htmlspecialchars() nl2br() stripslashes()

Ói¨: string rawurldecode(string str);
µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ±aÂe´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½«×Ö
u´®½aÂe¡£´Ó URL µÄ×Öu´®×¨Óøñʽ½a³ÉÆÕͨ×Öu´®¡£ÏeϸµÄ±aÂe½aÂeÐÅÏ¢¼°¹ae¸ñÎļþ¿ÉÒԲο¼ RFC 1738¡£
²Î¿¼: rawurlencode()

Ói¨: string rawurldecode(string str);
µ»ØÖµ: ×Öu´®
º¯ÊýÖÖÀa: ±aÂe´¦Ài
ÄÚÈÝ˵Ã÷: ±¾º¯Êý½«×Ö
u´®±aÂe³É URL µÄ×Öu´®×¨Óøñʽ£¬ÌØÊaµÄ×Öu»aת»»³É°ÙÖ±ÈuºÅºoÃae¼ÓÉ϶þ¸oÊ®ÁuλÊý×ֵĸñʽ¡£ÀýÈ磬¿Õ¸ñ¾Í»a±a³É %20¡£
ʹÓÃ*¶Àý
<?php
echo '';
?>
²Î¿¼: rawurldecode()

µ±Ç°1/2Ò³ 12ÏÂÒ»Ò³ÔĶÁÈ«ÎÄ

 相关文章:
PHP分页显示制作详细讲解
SSH 登录失败:Host key verification failed
获取IMSI
将二进制数据转为16进制以便显示
获取IMEI
文件下载
贪吃蛇
双位运算符
PHP自定义函数获取搜索引擎来源关键字的方法
Java生成UUID
发送邮件
年的日历图
提取后缀名
在Zeus Web Server中安装PHP语言支持
让你成为最历害的git提交人
Yii2汉字转拼音类的实例代码
再谈PHP中单双引号的区别详解
指定应用ID以获取对应的应用名称
Python 2与Python 3版本和编码的对比
php封装的page分页类完整实例