--- title: PHP6 -VS CODE 開始 tags: PHP --- http://localhost:8012/phpmyadmin/tbl_sql.php?db=2022030501&table=%E5%AD%B8%E7%94%9F%E8%B3%87%E6%96%99 C:\xampp\htdocs\myphp  邏輯運算子 ==等於 === 全等 ! 不是 要把下面兩個都打開.網頁才可以打開   http://localhost:8012/myphp/0312-01.php  --- unset 是指 移除變數  --- if 判斷式 http://localhost:8012/myphp/0319-01.php    ```` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <?php $mynum = 100; if($mynum == 100){ echo "很棒喔~滿分100分"; } ?> </body> </html> ```` --- if +else 否則就.....   --- if +else if+ else  --- 排好=格式化文件 =shift+alt+f    ```` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <?php $mynum = 22; if ($mynum == 100) { echo "很棒喔~滿分100分"; } else if ($mynum >= 60) { echo "恭喜及格"; } else { echo "不及格 =補考"; } ?> </body> </html> ```` 兩個等號才是相等  --- 這樣寫0會出現不及格..但是不會寫補考...所以有錯...   ---   --- 產生前端 語法-  --- 現在想要做出來的成果-  --- 程式碼- ```` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <?php if(!isset($h)){$h=1.72;} if(!isset($w)){$w=60;} $bmi = round($w/($h*$h),1); echo "<br>"; if($bmi >=30 ){$status = "肥胖!";} elseif ($bmi >=25 ){$status = "過重!";} elseif ($bmi >=18.5 ){$status = "標準!";} else{$status = "過輕!";} ?> <div> <p>您的身高是:<?php echo $h*100; ?></p> <p>您的體重是:<?php echo $w; ?>公斤</p> <p>您的BMI數值是:<?php echo $bmi; ?></p> <p>您的BMI判斷標準為:<?php echo $status; ?></p> </div> </body> </html> ````   --- 判斷式- 判斷是否為 文字 is_string() / 數字 is_numeric() /整數 is_int() --- 成績 要做出來的成果  ```` ```` --- switch  if 的 都 可以寫成 switch  --- while 迴圈 - 執行重複動作 -跑了10次 **注意邏輯..最怕無窮迴圈**  ```` ```` --- do while 迴圈 -  ```` ```` --- for 迴圈 - 嚴謹   ```` ```` --- 放10張圖檔在自己的myphp 裡面- C:\xampp\htdocs\myphp   網頁裡面的/是這個方向 會跟複製的相反   加入FOR 迴圈 讓照片1-10顯示 -用3行取代很多行 ```` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <!--<img src="pic1/1.jpg"> //外面是2個" --> <?php //<img src="pic1/1.jpg"> //外面是2個" for ($a = 1 ;$a <= 10 ; $a ++ ){ echo"<img src='pic1/$a.jpg'>"; //裡面是一個' } ?> </body> </html> ````  --- 在BODY 下面 怎麼不能用 // 註解  要用 ```` body裡面註解是 <!-- --> ````  --- HTML的註解長這樣 在VS CODE 也可以按 CTRL +L 會加上相對位置的註解 ```` body裡面註解是 <!-- --> css註解 /* */ js註解是 // ```` --- 再放入100張圖- C:\xampp\htdocs\myphp  http://localhost:8012/myphp/0319-04.php \n 代表程式碼換行- ```` ```` 另外一種寫法- 之後只要改資料夾名稱- ```` ```` --- ```` ```` --- 抓100張照片方法1  抓100張照片方法2  ---- 其他-  把不規則 檔案全部抓進來的方法-  --- 面試必考題 9×9法表 ```` ```` 用 FOR 迴圈 試試 ```` ```` ---
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up