PHPã®è¦ãã¦ããããåºç¤é ç®
PHPã使ã£ã¦ããã°ã©ãã³ã°ããå ´åã«è¦ãã¦ããããåºç¤é ç®ããªã¹ãã¢ãããã¾ããã
ç®æ¬¡
å ¥åºåå¦ç
ãã¡ã¤ã«å ¥åºå
(1). ããã¹ããã¡ã¤ã«ããã®èªã¿è¾¼ã¿ 以ä¸ã®é¢æ°ãçµã¿åããã¦ããã¹ããã¡ã¤ã«ããã®èªã¿è¾¼ã¿ãè¡ãã ã»fopen() ã»feof() ã»fgets() ã»fclose() (2). ããã¹ããã¡ã¤ã«ã¸ã®æ¸ã込㿠以ä¸ã®é¢æ°ãçµã¿åããã¦ããã¹ããã¡ã¤ã«ã¸ã®æ¸ãè¾¼ã¿ãè¡ãã ã»fopen() ã»fputs() ã»fclose()
ãã°åºå
error_log()é¢æ°ã使ç¨ãã¦ãã¡ã¤ã«ãsyslogã¸ã®ãã°åºåãã§ããã
DBã¢ã¯ã»ã¹(PDO)
PDO(PHP Data Object)ãå©ç¨ããã¨ãå ±éã®APIã§æ§ã ãªãã¼ã¿ãã¼ã¹ã«ã¢ã¯ã»ã¹ã§ããã ã¢ã¯ã»ã¹ãããã¼ã¿ãã¼ã¹æ¯ã«åºæã®PDOãã©ã¤ããç¨æããå¿ è¦ãããã (1). DBã¸æ¥ç¶ $pdo = new PDO() (2). DBããåæ å¤æ°ã«nullãè¨å® $pdo = null (3). selectæå®è¡ $stmt = $pdo->query() (4). çµæã»ãããã1è¡åå¾ $row = $stmt->fetch() (5). insert/update/deleteæå®è¡ $pdo->exec()
ç·¨éå¦ç
åºæ¬çãªãã¼ã¿æ§é
PHPã®é åã¯ãããã¨ãã¦ãå©ç¨å¯è½ã (1). é å ã»é åã®çæ ã»é åã¸ã®ãã¼ã¿è¿½å ã»é åããã®ãã¼ã¿åå¾ ã»é åã¸ã®ç¹°ãè¿ãå¦ç(foræ) (2). ããã(é åããããã¨ãã¦å©ç¨) ã»ãããã®çæ ã»ãããã¸ã®ãã¼ã¿æ ¼ç´ ã»ãããããã®ãã¼ã¿åå¾ ã»ãããã¸ã®ç¹°ãè¿ãå¦ç(foreachæ)
ã¡ã¢ãªä¸ã®ãã¼ã¿æä½
(1). 1件ã®ãã¼ã¿ã®ã¡ã¢ãªã¸ã®æ ¼ç´ ï¼ä»¶ã®ãã¼ã¿ã¯ãããã«æ ¼ç´ã§ããã ã«ã©ã åããã¼ã¨ãã¦å¤ããããã«æ ¼ç´ããã (2). è¤æ°ä»¶ã®ãã¼ã¿ã®ã¡ã¢ãªã¸ã®æ ¼ç´ è¤æ°ä»¶ã®ãã¼ã¿ã¯ãããã®é åã«æ ¼ç´ã§ããã ãã¼ã¿ä»¶æ°åããããä½æããããããé åã«æ ¼ç´ããã (3). è¤æ°ä»¶ã®ãã¼ã¿ã®åºæ¬çãªæä½ foræã§ç¹°ãè¿ãã¦é åä¸ã®ãã¼ã¿ãï¼ä»¶ãã¤å¦çããã (4). è¤æ°ä»¶ã¬ã³ã¼ãã®é«åº¦ãªæä½ ä»¥ä¸ã®æä½ã«æ £ããã¨ããã æ½åºãã½ã¼ããçµåãéè¨
æååç·¨é
(1). çµå çµåæ¼ç®å(.) (2). åå² explode() (3). ç½®æ str_replace() (4). åãåºã substr() (5). æ¤ç´¢ strstr()
æ°å¤ç·¨é
(1). ååæ¼ç® +ã-ã*ã/ã%æ¼ç®å (2). 大ããªæ°å¤ã®æ¼ç® GMPé¢æ°ãBC Mathé¢æ° (3). æ°å¤ã®ãã©ã¼ããã number_format()
æ¥æç·¨é
(1). æ¥æã®åå¾ date_create() (2). æ¥æã®å æ¸ç® date_add() date_interval_create_from_date_string() (4). æ¥æã®å·®å date_diff() (5). æ¥æâæåå date_format() date_create_from_format()
Webé¢é£å¦ç
HTTPæä½
(1). HTTPãªã¯ã¨ã¹ããããã®åå¾ getallheaders(); (2). HTTPãªã¯ã¨ã¹ããã©ã¡ã¼ã¿ã®åå¾ $_GET $_POST (3). HTTPã¬ã¹ãã³ã¹ãããã®è¨å® header() (4). ã¹ãã¼ã¿ã¹ã³ã¼ãã®è¨å® header() (5). HTTPã¬ã¹ãã³ã¹ããã£ã®åºå(HTMLçã®åºå) print()
ã»ãã·ã§ã³æä½
(1). ã»ãã·ã§ã³ã®éå§ session_start(); (2). ã»ãã·ã§ã³ã¸ã®ãã¼ã¿æ ¼ç´ $_SESSION[ãã¼] = å¤ (3). ã»ãã·ã§ã³ããã®ãã¼ã¿åå¾ $_SESSION[ãã¼] (4). ã»ãã·ã§ã³ããã®ãã¼ã¿åé¤ unset($_SESSION[ãã¼]); (5), ã»ãã·ã§ã³ã®åæ setcookie() session_destroy()