PHP ??? ?? ??
??, ??? ? ??????? ?? ???? ?? ????? ???? ? ?? ??? ?????. ??? ??????? ???? ?? ???? ?????.
?? PHP?? ??? ??? ?? ????. ??? ?? ????? ???? ? ?? ??? ???? ??? ????.
1. ?? ??? ??? ?? ??
2. ?? ??? ??? ?? ??
3. ??? ??? ?? ??
? ??? ?? ??? ??? ??? ?????????.
1. ??? ??? ?? 2??? ?? 3???? ??????. ???? ??? ??, ?? ? 1??? ???? ??? ? ?? ???? ??? ? ????. ??? ?? ??? ??? ? ????
2. ??? ?? ?? ??? ? ??? ??? ??? ????. ?? ?? GBK? UTF-8? ??
3. ??? ?? ??? ??? ???? ????. ???? ???? ???
??? ????? ???? ? ?? ??? ??? ??? ??? ???.
?? ??? ? ? ??? PHP ??? ??? ??? ?????.
???. ? ??? ?? ???? ???????
?? ??? ?? ?? ??? ????. PHP ??? ????? ?? ??? ??? ?? ????? ???? ????? ??????.
?? ???? ??????? ??? ?? ??? ???.
PHP ?? ??:
??? | ?? | ???? |
---|---|---|
trim() | ??? ?? ?? ?? ???? ?? ?? ??? ??? ????? | "$str = "rnHello World!rn"; echo Trim($str); |
rtrim() | ??? ???? ???? ?? ?? ??? ??? ????? | "$str = "Hello World!nn"; echo rtrim($str);" |
chop() | rtrim()? ?? | ?? ?? |
ltrim( ) | ??? ???? ???? ?? ?? ??? ??? ????? | "$str = "rnHello World!"; echo ltrim($str);" |
dirname( ) | ??? ???? ???? ?????(??? ??? ???????) | echo dirname("c:/testweb/home.php "); |
str_pad() | ??? ??? ???? Pall | $str = "Hello World"; echo str_pad($str ,20,". "); |
str_repeat() | ??? ??? ?? | echo str_repeat(".",13); |
str_split() | ???? ??? ?? | print_r(str_split("Hello")); |
strrev() | ??? ?? | echo strrev("Hello World!"); |
wordwrap() | ??? ??? ?? ??? ?? | "$str = ""? ??? ?? ?: Supercalifragulistic""; echo wordwrap($str,15);" |
str_shuffle() | ???? ?? ??? ???? ???? | echo str_shuffle("Hello World"); |
parse_str() | ???? ??? ?? ?? | "parse_str("id=23&name=John%20Adams",$myArray); print_r($myArray);" |
number_format() | ? ??? ?? ?? ?? | "echo number_format("1000000"); echo number_format("1000000",2) ; echo number_format("1000000 ",2,"","","".");" |
strtolower() | ???? ???? ?? | echo strtolower("Hello WORLD!"); |
strtoupper() | ???? ???? ?? | echo strtoupper ("Hello WORLD!"); |
ucfirst() | ???? ? ??? ???? ?????. | echo ucfirst("hello world"); |
ucwords() | ???? ?? ? ??? ? ?? ??? ???? ?? | echo ucwords("hello world"); |
htmlentities() | ??? HTML ???? ?? | $str = ""John & 'Adams'""; echo htmlentities($str, ENT_COMPAT) |
htmlspecialchars() | ?? ??? ??? HTML ????? ?? | |
nl2br() | n? ?? | echo nl2br("? ?.n?? ?.");?? ????????. > |
HTML, XML ? PHP ?? ?? | echo Strip_tags("Hello | world!") |
???? ??? ???????? ??? ?? ?? ????? ?????. | $str = ""?????, ? ??? John???. Adams." echo $str; echo addcslashes($str,'m');" | |
addcslashes() ????? ??? ?? ?? | echo Stripcslashes("?????, ? ??? Kai Jim???."); | |
?? ??? ??? ???? ?? ????? ????? | $str = "John Adams? ??????";echo addlashes($str); | |
addlashes()? ?? ??? ????? ??? ?? | echo Stripslashes("John Adams? ??????"); | |
???? ?? ??? ?? ?? ?? ????? ?????. | $str = "Hello world. (? ?? ?????)"; echo quotemeta($str); | |
??? ?????. ??? ASCII ??? | echo chr(052); | |
???? ? ?? ??? ASCII ?? ????? | echo ord("hello"); | |
????? ???? ????. ? ??? ?? | echo strcasecmp ("Hello world!","HELLO WORLD!"); | |
???? ?? ? ??? ?? | ||
???? ?? n? ??? ?????(???? ??) | ||
strncasecmp() | ???? ?? n?? ???? ????? ???? ????. | int strncasecmp( string $str1 , string $str2 , int $len ) |
strnatcmp() | ??? ??? ???? ?? ?? ??, ???? ?? | int strnatcmp( string $str1 , string $str2 ) |
strnatcasecmp() | ????? ???? ?? ??? ??? ???? ?? ?? ?? | int strnatcasecmp( string $str1 , string $str2 ) |
chunk_split() | ???? ?? ???? ??? | str Chunk_split(str $body[,int $len[,str $end]] ) |
strtok() | ??? ???? | str strtok(str $str,str $token) |
explode() | ? ???? ???? ???? ?? ???? ?? | arrayexplode(str $sep,str $str[,int $limit ]) |
implode() | ??? ??, ?? ??? ??? ???? ?? ?? ???? ?? | string implode( string $glue , array $pieces ) |
substr() | ??? ???? | string substr ( string $string , int $start [, int $length ] ) |
str_replace() | ??? ?? ??, ???? ?? | mix str_replace(mix $search,,mix $replace,mix $subject [,int &$num]) |
str_ireplace() | ??? ?? ??, ???? ?? ? ? | mix str_ireplace ( mix $search , mix $replace , mix $subject [, int &$count ] ) |
substr_count() | ?? ????? ???? ?? ??? ?????. | int substr_count ( string $haystack , string $needle [, int $offset = 0 [, int $length ]] ) |
substr_replace() | ???? ???? ?? ???? ??? | mixed substr_replace ( mix $string , string $replacement , int $start [, int $length ] ) |
similar_text() | ??? ?????. ? ???? ??? ?? | int ???_text(str $str1,str $str2) |
strchr( ) | ???? ???? ?????. ?? ???? ??? | string strstr ( string $str, string $needle, bool $before_needle) |
strrchr() | ?? ???? ??? ????? ???? ??? | string strrchr( string $haystack , mix $needle ) |
stristr() | ????? ???? ?? ?? ???? ???? ??? ???? ?????. | string stristr( string $haystack , mix $needle [, bool $before_needle = false ] ) |
strtr() | ???? ?? ?? ?? | string strtr ( string $str , string $from , string $to ) |
strpos() | ????? ? ?? ?? ?? ?? ?? | int strpos ( string $haystack , Mixed $needle [, int $offset = 0 ] ) |
stripos() | ????? ????? ???? ?? ?? ???? ??? ????. | int Stripos( string $haystack , string $needle [, int $offset ] ) |
strrpos() | ????? ??? ??? ?? ?? | int strrpos ( string $haystack , string $needle [ , int $offset = 0 ] ) |
strripos() | ????? ???? ?? ????? ??? ??? ??? ????. | int strripos ( string $haystack , string $needle [, int $offset ] ) |
strspn() | ??? ?? ??? ??? ???? ? ?? ???? ????? | int strspn ( string $str1 , string $str2 [, int $start [, int $length ]] ) |
strcspn() | ??? ?????. ???? ???? ?? ??? | int strcspn ( string $str1 , string $str2 [, int $start [, int $length ]] ) |
str_word_count() | ???? ??? ?? ? ?? | mix str_word_count(str $str,[]) |
strlen() | ??? ?? ?? | int strlen(str $str) |
count_chars() | ??? ?? ??? ?? ?? ???(0..255) | mixed count_chars( string $string [, int $mode ] ) |
md5() | String md5 ??? | $str = "?????"; echo md5($str) |
iconv | ||
??? ?? ???? | string mb_substr ( string $str , int $start [, int $ length = NULL [, string $encoding = mb_internal_encoding() ]] ) | |
HTTP ?? ?? ??? ??/???? | ?? mb_http_output( [ string $ ??? = mb_http_output() ] ) | |
???? ??? ????? | mixed mb_strlen( string $str [, string $ ??? = mb_internal_encoding() ] ) | |
???? ?? ?? ???? ?? ?????. | string iconv ( string $in_charset , string $ out_charset , string $str ) | |
??? ?? ???? | ||
iconv ?? ?? ?? ?? ???? | ||
??? ?? ?? ?? | ||
??? ????? ???? ???? ?? | ||
????? ????? ???? ??? ?? | ||
?? ???? ???? ????? ??? ?? | ||
URL? ??? ?? |