echo 'date.timezone: '. ini_get('date.timezone'); Check server time zone"> echo 'date.timezone: '. ini_get('date.timezone'); Check server time zone">

งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

PHP. Date and Time date(format,timestamp) <?php echo "Today is ". date("Y/m/d"). " "; echo "Today is ". date("Y.m.d"). " "; echo "Today is ". date("Y-m-d").

งานนำเสนอที่คล้ายกัน


งานนำเสนอเรื่อง: "PHP. Date and Time date(format,timestamp) <?php echo "Today is ". date("Y/m/d"). " "; echo "Today is ". date("Y.m.d"). " "; echo "Today is ". date("Y-m-d")."— ใบสำเนางานนำเสนอ:

1 PHP

2 Date and Time date(format,timestamp) <?php echo "Today is ". date("Y/m/d"). " "; echo "Today is ". date("Y.m.d"). " "; echo "Today is ". date("Y-m-d"). " "; echo "Today is ". date("l"); ?>

3 Time zone <?php date_default_timezone_set("America/New_York"); echo "The time is ". date("h:i:sa"); ?> echo 'date.timezone: '. ini_get('date.timezone'); Check server time zone http://php.net/manual/en/timezones.php

4 Arrays <?php $cars = array("Volvo", "BMW", "Toyota"); echo "I like ". $cars[0]. ", ". $cars[1]. " and ". $cars[2]. "."; ?>

5 The count() Function <?php $cars = array("Volvo", "BMW", "Toyota"); echo count($cars); ?>

6 Array: Loop <?php $cars = array("Volvo", "BMW", "Toyota"); $arrlength = count($cars); for($x = 0; $x < $arrlength; $x++) { echo $cars[$x]; echo " "; } ?>

7 PHP - Sort Functions For Arrays Sort Array in Descending Order - rsort() <?php $cars = array("Volvo", "BMW", "Toyota"); rsort($cars); $clength = count($cars); for($x = 0; $x < $clength; $x++) { echo $cars[$x]; echo " "; } ?>

8 PHP - Sort Functions For Arrays Sort Array in Ascending Order - sort() <?php $cars = array("Volvo", "BMW", "Toyota"); sort($cars); $clength = count($cars); for($x = 0; $x < $clength; $x++) { echo $cars[$x]; echo " "; } ?>

9 PHP Global Variables - Superglobals $GLOBALS $_SERVER $_REQUEST $_POST $_GET $_FILES $_ENV $_COOKIE $_SESSION

10 $GLOBALS $GLOBALS is a PHP super global variable which is used to access global variables from anywhere in the PHP script (also from within functions or methods). PHP stores all global variables in an array called $GLOBALS[index]. The index holds the name of the variable.

11 Example <?php $x = 75; $y = 25; function addition() { $GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y']; } addition(); echo $z; ?>

12 $_SERVER $_SERVER is a PHP super global variable which holds information about headers, paths, and script locations. <?php echo $_SERVER['PHP_SELF']; echo " "; echo $_SERVER['SERVER_NAME']; echo " "; echo $_SERVER['HTTP_HOST']; echo " "; echo $_SERVER['HTTP_REFERER']; echo " "; echo $_SERVER['HTTP_USER_AGENT']; echo " "; echo $_SERVER['SCRIPT_NAME']; ?>

13 $_REQUEST, $_POST, $_GET PHP $_REQUEST is used to collect data after submitting an HTML form.

14 PHP Forms - POST Name: E-mail:

15 welcome.php Welcome Your email address is:

16 PHP form - GET Name: E-mail:

17 welcome_get.php Welcome Your email address is:

18 GET vs. POST $_GET is an array of variables passed to the current script via the URL parameters. $_POST is an array of variables passed to the current script via the HTTP POST method.

19 When to use GET? GET method is visible to everyone The limitation is about 2000 characters. GET may be used for sending non-sensitive data.

20 When to use POST? the POST method is invisible to others. has no limits on the amount of information to send. Developers prefer POST for sending form data.

21 Exercise เขียนโปรแกรมรับค่ารับค่าตัวเลข 1 ค่า แล้วนำ ตัวเลขนั้นไปคำนวณหาเลขยกกำลัง 3 เขียนโปรแกรมรับชื่อ วันเดือนปีเกิด จากนั้นให้ แสดงชื่อ วันเดือนปีเกิด และอายุของคนๆ นั้น ให้รับค่าตัวเลข 10 แล้วให้แสดงผลโดยเรียง จากเลขมากไปหาน้อย


ดาวน์โหลด ppt PHP. Date and Time date(format,timestamp) <?php echo "Today is ". date("Y/m/d"). " "; echo "Today is ". date("Y.m.d"). " "; echo "Today is ". date("Y-m-d").

งานนำเสนอที่คล้ายกัน


Ads by Google