
- 這個活動已經結束。
PHP ReTeach 2
四月 18, 2018 @ 5:00 下午 - 6:00 下午
- 檔案IO
- GET
- 字串處理
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?php //String $s = "You are a Pig"; $a = explode(" ",$s); var_dump($a); //GET var_dump($_GET); $a = $_GET["a"]; var_dump($a); //File IO /* a+ append and create r read w+ write and create */ $handle = fopen("text.txt","a+"); fwrite($handle,"PIGGY!!!\n"); fclose($handle); ?> |
作業
繳交:http://sd.totalh.net/p/PHPHW/
嗨 (Hi.php)
使用$_GET取得”name”,輸出”Hi (name)!!”
Example:
http://XXX.lssc.cf/Hi.php?name=SuperDavid
必須輸出”Hi SuperDavid!”(無雙引號)
第二個字 (Second.php)
使用$_GET取得”text”,輸出text中的第二個字
Example:
http://XXX.lssc.cf/Hi.php?text=How are you
必須輸出”are”(無雙引號)
書寫機 (Writer.php)
使用$_GET取得”text”,並寫入”Paper.txt”(必須在text後加換行,使用”a+”模式)
Example:
http://XXX.lssc.cf/Hi.php?text=LSSC is the best
將”LSSC is the best\n”(無雙引號)寫入至Paper.txt