After following, you can keep track of his dynamic information in a timely manner
Courses in the relevant section:Traverse array
foreach( 要循環(huán)的數(shù)組變量 as [鍵變量 =>] 值變量){ //循環(huán)的結(jié)構(gòu)體 }
2016-11-290個(gè)贊
Courses in the relevant section:Array sort
sort() - 對數(shù)組進(jìn)行升序排列 rsort() - 對數(shù)組進(jìn)行降序排列 asort() - 根據(jù)關(guān)聯(lián)數(shù)組的值,對數(shù)組進(jìn)行升序排列 ksort() - 根據(jù)關(guān)聯(lián)數(shù)組的鍵,對數(shù)組進(jìn)行升序排列 arsort() - 根據(jù)關(guān)聯(lián)數(shù)組的值,對數(shù)組進(jìn)行降序排列 krsort() - 根據(jù)關(guān)聯(lián)數(shù)組的鍵,對數(shù)組進(jìn)行降序排列
2016-11-290個(gè)贊
Courses in the relevant section:Multidimensional Arrays
一維數(shù)組 數(shù)組里面沒有其他數(shù)組,只有單純的一些變量或者值。 二維數(shù)組 數(shù)組里面插入了單層的一個(gè)數(shù)組,或者多個(gè)數(shù)組 三維數(shù)組 在數(shù)組(A)里面插入了一個(gè)數(shù)組(B),在B數(shù)組里面又插入了一層級的數(shù)組(C),這種我們就稱為三維數(shù)組 超過三維的,統(tǒng)統(tǒng)都叫多維數(shù)組。
2016-11-290個(gè)贊
Courses in the relevant section:Custom function
使用關(guān)鍵字“function”開始 函數(shù)名可以是字母或下劃線開頭:function name() 在大括號中編寫函數(shù)體 function 函數(shù)名(){ 代碼; }
2016-11-290個(gè)贊
Courses in the relevant section:function parameters
<?php function a($i,$j){ $c = $i + $j; echo $c; } //調(diào)用函數(shù) a(3,5); //這樣就吧3傳給了$i 5傳給了$j;輸出結(jié)果為8
2016-11-290個(gè)贊
Courses in the relevant section:return value
function 函數(shù)名(參數(shù)1, 參數(shù)2……) { 運(yùn)算過程 return 運(yùn)算結(jié)果; }
2016-11-290個(gè)贊
Courses in the relevant section:variadic function
function name() { echo 'jobs'; } $func = 'name'; $func(); //調(diào)用可變函數(shù)
2016-11-290個(gè)贊
Courses in the relevant section:built-in functions
PHP內(nèi)置了很多標(biāo)準(zhǔn)的常用的處理函數(shù),包括字符串處理、數(shù)組函數(shù)、文件處理、session與cookie處理等。
2016-11-290個(gè)贊
Courses in the relevant section:Determine whether the function exists
當(dāng)我們創(chuàng)建了自定義函數(shù),并且了解了可變函數(shù)的用法,為了確保程序調(diào)用的函數(shù)是存在的,經(jīng)常會先使用function_exists判斷一下函數(shù)是否存在。
2016-11-290個(gè)贊
Courses in the relevant section:php form
應(yīng)該在任何可能的時(shí)候?qū)τ脩糨斎脒M(jìn)行驗(yàn)證(通過客戶端腳本)。瀏覽器驗(yàn)證速度更快,并且可以減輕服務(wù)器的負(fù)載。
2016-11-290個(gè)贊
Courses in the relevant section:form validation
& (和號) 成為 & " (雙引號) 成為 " ' (單引號) 成為 ' < (小于) 成為 < > (大于) 成為 >
2016-11-290個(gè)贊
Courses in the relevant section:PHP form - required fields
在以下代碼中我們加入了一些新的變量: $nameErr, $emailErr, $genderErr, 和 $websiteErr.。這些錯(cuò)誤變量將顯示在必需字段上。 我們還為每個(gè)$_POST變量增加了一個(gè)if else語句。 這些語句將檢查 $_POST 變量是 否為空(使用php的 empty() 函數(shù))
2016-11-290個(gè)贊
Courses in the relevant section:Verification email and URL
.匹配名稱 “/^[a-zA-Z ]*$/” 只允許空格和字母,”^”表示開頭,”$”表示結(jié)尾,[a-zA-Z ]表示a-z或者A-Z或者空格中的一個(gè)字符 匹配URL “/\b(?:(?:https?|ftp):\/\/|www.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i”
2016-11-290個(gè)贊
Courses in the relevant section:Complete form example
<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>
2016-11-290個(gè)贊
Courses in the relevant section:$_GET variable
預(yù)定義的 $_GET 變量用于收集來自 method="get" 的表單中的值
2016-11-290個(gè)贊