1.37k likes | 1.62k Views
???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? . ???????????????. ??????????????????????????????????? PHP?????????????????? PHP ?????????????????? MYSQL ??????????????????????????????????????????????????????????????????????????????????????????????????????????
E N D
1. ???????????????????????????????????????????? PHP ????? ???????? ??????????????????????????????????????????????
?????????????????????????? ???????????? ??? ???????????????????????????????????????????????????????????????????
?????????????????????????? ???????????? ??? ?????????????????????
2. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ??????????????? ?????????????????????????? ?? IT 20 ?? ???????? 19 ?? ???????????????????????????????
???????????????????????????????????????????????????????? HTML ,????????? Programming ??? ??????????????????????????????????? ?? IT 20 ?? ???????? 19 ?? ???????????????????????????????
???????????????????????????????????????????????????????? HTML ,????????? Programming ??? ?????????
3. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ???????????? ?????? 12 ?????????? 2550
?????????????? , ?????????? AppServ, ?????????? Eclipse
?????? 13 ?????????? 2550
???????????????????????? ?
?????? 14 ?????????? 2550
???????? Web Form, ?????????????????, phpMyadmin
?????? 15 ?????????? 2550
???????????????????? ITIL
?????? 16 ?????????? 2550
???????????????????? ITIL
4. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Download ?????????????????????? ????? Folder ???? c:\php_train
ftp://ftp.nso.go.th/public/Training/PHP_2550
???????????????? Tools ???????????????????? Save Target As ?????? c:\php_train
???????????????? PHP ???????????????????? Save Target As ?????? c:\php_train ????????? Download ?????????? 2 ????? ???????? 1 ??????????????????? ??? ???????? 2????????? Download ?????????? 2 ????? ???????? 1 ??????????????????? ??? ???????? 2
5. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ??????????????
6. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ????????????????????????????? ??????????????????? ?????????? (Algorithm) ?????????????????? (Data Structure)
???????????????????????????????????? (Software Engineering)
??????????????????? HTML, XHTML, CSS, DOM, JavaScript, XML
??????????????????????????????????????????? ???? Application Server , Framework, Programming
????????????????????????????????????????? (Programming Language)
?????????????????????????????????????????????????????? (Web Application Security) ???????????? : ?????????????????????????????????????????????????????
?????????? : ????????????????? ???? ?????????????? ????????????? ????????????????????????? ???????? Big O ???? O(n)
Data structure : array, List, Tree, Hashtable, queue, stack
SE : Quality, Cost, Reuse -> Development Process, Method???????????? : ?????????????????????????????????????????????????????
?????????? : ????????????????? ???? ?????????????? ????????????? ????????????????????????? ???????? Big O ???? O(n)
Data structure : array, List, Tree, Hashtable, queue, stack
SE : Quality, Cost, Reuse -> Development Process, Method
7. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Web Application Model ?????? web 1.0 , web 1.5 web 2.0?????? web 1.0 , web 1.5 web 2.0
8. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Web Application Deployment ???????????????
1. Browser Client
2. Web Server + App Server + Web Application
3. Database Server (Oracle,mysql, MSSQL)???????????????
1. Browser Client
2. Web Server + App Server + Web Application
3. Database Server (Oracle,mysql, MSSQL)
9. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ?????????????? 3-Tier ????????????? 2-Tier - > ??? 3-Tier -> ??? M-Tier ???? Web Service????????????? 2-Tier - > ??? 3-Tier -> ??? M-Tier ???? Web Service
10. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ??????????????????? MVC ???????????? : ?????????? 3 ???? ??? view , model, control ???? Controller Layer
???????????????????????????
??????????????????????????
????????????????? Reuse???????????? : ?????????? 3 ???? ??? view , model, control ???? Controller Layer
???????????????????????????
??????????????????????????
????????????????? Reuse
11. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? MVC Model VIEW
???????????????????? ???? images, CSS,JS,XX.php
Control
Action
config
Model
business
Database
metadata
12. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? W3 Schools
13. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Certificate
14. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? HTML Document <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>My first HTML document</TITLE>
</HEAD>
<BODY>
<P>Hello world!
</BODY>
</HTML>
??????????????????????? Help ??? HTML 4.x
?????????? ??????????????????????????????????????????????? Help ??? HTML 4.x
?????????? ????????????????????????
15. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? What Is XHTML ? XHTML stands for EXtensible HyperText Markup Language
XHTML is aimed to replace HTML
XHTML is almost identical to HTML 4.01
XHTML is a stricter and cleaner version of HTML
XHTML is HTML defined as an XML application
XHTML is a W3C Recommendation
16. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? XHTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>simple document</title>
</head>
<body>
<p>a simple paragraph</p>
</body>
</html> XHTML Syntax Rules:
Attribute names must be in lower case
Attribute values must be quoted
Attribute minimization is forbidden
The id attribute replaces the name attribute
The XHTML DTD defines mandatory elements
XHTML Syntax Rules:
Attribute names must be in lower case
Attribute values must be quoted
Attribute minimization is forbidden
The id attribute replaces the name attribute
The XHTML DTD defines mandatory elements
17. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? What is xml ? XML stands for EXtensible Markup Language
XML is a markup language much like HTML
XML was designed to describe data
XML tags are not predefined. You must define your own tags
XML uses a Document Type Definition (DTD) or an XML Schema to describe the data
XML with a DTD or XML Schema is designed to be self-descriptive
XML is a W3C Recommendation
http://www.w3schools.com/xml/xml_examples.asp To enable XSL support, add or uncomment the following line in the php.ini file:
extension=php_xsl.dll To enable XSL support, add or uncomment the following line in the php.ini file:
18. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Style Sheet ?????? presentation style ??? document ??????????????????? documents.
CSS simplifies Web authoring and site maintenance such as the text ,the backgrounds, the font size and style.
http://www.w3schools.com/css/default.asp
19. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? JavaScript JavaScript is a scriping language designed for adding interactivity to HTML pages
JavaScript is an interpreted language .
<script language="JavaScript"><!-- document.write("This text is written using JavaScript!")//--></script>
20. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? DOM (Document Object Model )
????????????????? Login ????????????????????????????? Login ????????????
21. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Object Collection
22. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Object Methods
23. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Object Properties
24. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? SDLC
25. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? UML Diagram
26. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? UML (Unified Modelling Language )
27. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? PHP and the OWASP Top Ten Security Vulnerabilities Unvalidated Parameters
Broken Access Control
Broken Account and Session Management
Cross-Site Scripting (XSS) Flaws
Buffer Overflows
Command Injection Flaws
Error Handling Problems
Insecure Use of Cryptography
Remote Administration Flaws
Web and Application Server Misconfiguration
28. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ITIL WEB
Application
29. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ITIL Requirement Statement ???????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????? ????????????????????????????????????????????????????????????????????????? ?????????????????????????????? ????????????????????????????????
???????????????????????????????????????????????????????, ?????????? ??? ??????????? Support
30. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Development Process ?????????????? ???????? 4 ???????
Inception ( ???? Business Modeling ??? Requirement)
Elaboration (???? Analysis & Design)
Construction (???? ?????????????????, Test)
Transition (???? ?????????????? HW,SW, UAT)
???????
?????????????? & ??????????????????? (Process Flow)
????????????? (HW,SW)
???????????? (Coding)
????????????? (?????? 3M, QC, Meeting)
?????????????? ???????? 4 ???????
Inception ( ???? Business Modeling ??? Requirement)
Elaboration (???? Analysis & Design)
Construction (???? ?????????????????, Test)
Transition (???? ?????????????? HW,SW, UAT)
???????
?????????????? & ??????????????????? (Process Flow)
????????????? (HW,SW)
???????????? (Coding)
????????????? (?????? 3M, QC, Meeting)
31. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Tools Analysis Phase
Capture Requirement : Use case Diagram
Business Process : Activity Diagram
Object Domain : Class Diagram
Design Phase
Input & Output Design : Class Diagram, Prototype
Database Design : E-R Diagram, Class Diagram
Software Structure : Deployment Diagram
32. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Use Case
33. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Class Diagram
34. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ??????????
AppServ
35. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? AppServ Open Project
36. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? AppServ v 2.5.7
37. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ?????????? App Server v 2.5.7 ??????????????????? : appserv-win32-2.5.7.exe
????????????? C:\AppServ
???????????????
C:\AppServ\Apache2.2
C:\AppServ\Mysql
C:\AppServ\PHP5
C:\AppServ\WWW
??????????????? http:\\localhost
?????????????????????????????
C:\AppServ\WWW
38. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Security Warning
39. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Welcome
40. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Backup Old Data
41. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? License Agreement
42. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Folder ??????????
43. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Select Component
44. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Server Information
45. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? MySQL Server
46. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ??????????
47. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ?????????????????
48. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ??????????????????????????
49. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? http://localhost
50. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? PHP.INI
51. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Uninstall
52. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ?????????? IDE
eclipse 3.1
53. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ???????????????????? eclipse 3.1 jdk-1_5_0_07-windows-i586-p.exe
eclipse-SDK-3.1.2-win32.zip
dbg-2.15.1-win32-php516.zip
PHPEclipse1.1.3-2005-01-29.zip
net.sourceforge.phpeclipse_1.1.8.bin.dist.zip
54. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ????????????????? eclipse 3.1 ??????? JDK
extract ???? eclipse-SDK-3.1.2-win32.zip ???????? c:\eclipse
extract ???? net.sourceforge.phpeclipse_1.1.8.bin.dist.zip
???????? c:\eclipse
extract ???? PHPEclipse1.1.3-2005-01-29.zip ???????? c:\eclipse
extract ???? dbg-2.15.1-win32-php516.zip ?????????????? php_dbg.dll ?????????????? c:\appserv\php5\ext
55. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ????????????????? eclipse 3.1 (???) ????????? C:\WINDOWS\php.ini ??????????? notepad ??????
???????? extension
extension=php_dbg.dll ????????????? extension
????????????
[debugger]
debugger.enabled = on
debugger.profiler_enabled = on
debugger.JIT_host = clienthost
debugger.JIT_port = 7869
debugger.hosts_allow = localhost 127.0.0.1
debugger.hosts_deny=ALL
debugger.ports=7869, 10001, 10002, 10003, 10000/16
56. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ????????????????? eclipse 3.1 (???) ????? Stop Apache ???? Start ????
????? phpinfo
57. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Eclipse Concept Workspace (???? .metadata)
Perspective (??? PHP ??? Debug)
View
Editor
58. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? New ????? Project ????
File->New->PHP Project
????? PHP File ????
File->New->PHP File
????? HTML ????
File->New->HTML File
59. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? New Project
60. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? New PHP File
61. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ???????? Config ????? Run/Debug Program
62. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ???????? Config ????? Run/Debug Program
63. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ???????? Config ????? Run/Debug Program
64. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ???????????
PHP
65. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Rasmus Lerdorf
66. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? PHP History & Version PHP/FI (Personal Home Page / Forms Interpreter) : 2538
PHP 2.0 (PHP/FI 2.0)
PHP 3.0
PHP 4.0 (4.4.4)
PHP 5.0 (5.1.6)
67. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? PHP Reference http://www.w3schools.com/
http://www.php.net
http://www.phpfreaks.com
http://www.tizag.com
http://th2.php.net/manual/en/language.types.php
68. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? What is PHP ? PHP is a server-side scripting language, like ASP
PHP scripts are executed on the server
PHP supports many databases (MySQL, Informix, Oracle, Sybase, Generic ODBC, etc.)
PHP is an open source software (OSS)
PHP is free to download and use
69. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? What is a PHP File? PHP ?????????? HTML tags ??? PHP Tag (<?php .. ?> )
PHP ?????????????????? HTML
PHP ????????????? .php
70. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ??????????? PHP Interpreter
71. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? PHP Example <html>
<head>
<title>PHP Example</title>
</head>
<body>
<?php
echo "Hi, I'm a PHP script!";
?>
</body>
</html> Copy Folder ???? hello ??? c:\train_php\hello ????? c:\AppServ\www
????? New php project ???? hello
?????? hello.html ?????????????? html
?????? myphp.php
Copy Folder ???? hello ??? c:\train_php\hello ????? c:\AppServ\www
????? New php project ???? hello
?????? hello.html ?????????????? html
?????? myphp.php
72. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? PHP Tag Style ?????? 1 SGML Style : <? ... ?>
?????? 2 XML Style : <?php ... ?>
?????? 3 JavaScript Style :
<script language="php">
…
</script>
?????? 4 ASP or JSP Style : <% … %>
Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
; NOTE: Using short tags should be avoided when developing applications or
; libraries that are meant for redistribution, For portable, redistributable code,
; be sure not to use short tags.
short_open_tag = On
?????????? Allow ASP-style <% %> tags.
asp_tags = Off Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
; NOTE: Using short tags should be avoided when developing applications or
; libraries that are meant for redistribution, For portable, redistributable code,
; be sure not to use short tags.
short_open_tag = On
?????????? Allow ASP-style <% %> tags.
asp_tags = Off
73. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ?????????????????????????????? ??????????????????????
??????????????
???????????????
Syntax ???
Logic ??? ?????? IDE ??????????????????????? Syntax ???????
?????????? Logic ?????????????????????????????????? ???? ????????????
?????????? TDD?????? IDE ??????????????????????? Syntax ???????
?????????? Logic ?????????????????????????????????? ???? ????????????
?????????? TDD
74. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Coding Tips Indentation and Spacing
???????????????? ??? Space ?????????????????????????????? ????
<?php if(is_dir($directory)){function();} ?> ???????
<?phpif ( is_dir($directory) ) { function ();}
?>
Variable Naming ?????????
$variable_name ???? $first_name, $last_name
Function Naming ?????????
VariableName ???? GetText()
75. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Coding Tips (continue) Magic Numbers
??? if ($status == 3) ??????????????
define ('DELETED', '3');
if ($status == DELETED)
Single or double quotes
‘$first_name’ ????????? “$first_name”
?????????????????????? single quote ??????????????????????????????????
Brackets
?????? { } ???????????????????????????????????????????
76. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Flowchart ??? Pseudocode
77. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ??????????????????
78. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ????????(Comment) Single line -> //
???? // Connect To Database
Multiple line -> /*
…..
…..
*/
Shell-Style -> # …….
79. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ?????? (Variable) ??????????????????????????????????????
?????????????(Type Of Variable)
??????????????? (Scope Of Variable)
??????? Help ???????????????? Help ?????????
80. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ????????????????? (Variable ) ?????????????????? $ ?????????? ???? $name
???????????????(letter) ???? underscore ????????????????????? ?????? ???? underscores. ( it would be expressed thus: [a-zA-Z0-9_\x7f-\xff]*' )
????????????????????????????????????? (case-sensitive)
???????????????????????????? ???? $thai_month
PHP ??????????? Strong Type ???????????????? mixedmode ????????????????????????????????????
Predefined variables (????????????????????????)
81. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? PHP supports eight primitive types. Four scalar types:
boolean
integer
float (floating-point number, aka 'double')
string
Two compound types:
array
object
Two special types:
resource
NULL
Four pseudo-types types:
mixed
number
callback ??????????????????????????????????????
82. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ????????????? (Type Of Variable) Integer Number ???? $rows=200
Floating Point Number ???? $pi=3.1416
Boolean ???? $flag=true;
String ???? $name=“Songpon Maisalee”
Array ???? $arr = array(1,2);
Object ???? $obj = new ?????? 2 Slides ??????????????????????????? 2 Slides ?????????????????????
83. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Boolean TRUE or FALSE. Both are case-insensitive.
?????????????????????????????????????????????? 0 ???? false
???????????(????)??????????????????? ????????????????????????????????????
??????????????????????????Line
?????????????????? boolean.php (???? 5 ????)????????????????????????????????????
??????????????????????????Line
?????????????????? boolean.php (???? 5 ????)
84. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Integer & Floating Point ??????? integer ??????? CPU ???????????????????????? 2 billion (that's 32 bits signed)
??????? floating point ??????? CPU ???????????????????????? ~1.8e308 with a precision of roughly 14 decimal digits is a common value (that's 64 bit IEEE format). ?????? ??? Overflow ?????? ??? Overflow
85. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Integer decimal : [1-9][0-9]* | 0
hexadecimal : 0[xX][0-9a-fA-F]+
octal : 0[0-7]+
integer : [+-]?decimal |
[+-]?hexadecimal |
[+-]?octal
$a = 0123; // octal number (equivalent to 83 decimal)
$a = 0x1A; // hexadecimal number (equivalent to 26 decimal)
86. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Floating point LNUM : [0-9]+
DNUM : ([0-9]*[\.]{LNUM}) | ({LNUM}[\.][0-9]*)
EXPONENT_DNUM
( ({LNUM} | {DNUM}) [eE][+-]? {LNUM})
87. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? String ???????????????????? single quoted, double quoted, heredoc
???????? Array ???????????
?????? 64 ????????
String Function
strlen, strpos, strstr,strchar
substr, strcmp, str_replace
trim, rtrim
String Conversion : ????????????????
88. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Object ???????? class
class class_name { …Method/Function… }
_constructor() , _destruct()
Create Object
$var = new class_name;
Access Variable and Method in Object
$var->Varname Or Method;
inheritance By extends
class Named_Cart extends Cart {……}
Scope Resolution Operator (::)
parent::CONST_VAL,self::$myitem
89. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Computer Object Domain
90. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Array ???? Dynamic Array (??????????????????)
??????????? Function ???? ?????????????? ???? $var = array("foo" => "bar", 12 => true);
Index ???????? 0 ??????????????????????? Index ?????
?????????????????????????????????????????????(????????)
???????????? Dimension Array ???
Function ????????? Array (????? Help)
array, sizeof, unset ?????????????????????
Index ???? key?????????????????????
Index ???? key
91. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Array (Cont) array( [key =>] value , ... )
// key may be an integer or string
// value may be any value
$arr[key] = value; $arr[] = value;
// key may be an integer or string
// value may be any value
92. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Constants ??????????????????????????????????????????????????????????????
?????? define();
define ("MAXSIZE", 100);
echo MAXSIZE;
if (defined("CONSTANT")) {
echo CONSTANT;
}
93. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Type Casting (int), (integer) - cast to integer
(real), (double), (float) - cast to double
(string) - cast to string
(array) - cast to array
(object) - cast to object
94. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Variable Scope : ??????????????? Local Scope
By Default
Global Scope
global $a,$b ???? $GLOBALS[“x”]
Static
static $int =0; ??????????????????????????? global ??????????????????
1. ?????????????????????????? global??????????????????????????? global ??????????????????
1. ?????????????????????????? global
95. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Expr : Expression expression is "anything that has a value".
Any numeric non-zero numeric value is TRUE, zero is FALSE, negative values are non-zero and are thus considered TRUE.
The empty string and the string "0" are FALSE; all other strings are TRUE.
With non-scalar values (arrays and objects) - if the value contains no elements it's considered FALSE, otherwise it's considered TRUE.
96. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Operator : ???????? Arithmetic Operators : +, - , *, / , %
Assignment Operator : = ($var = &$othervar; Reference)
Incrementing/Decrementing Operators : ++$a, $a++, --$a, $a--
Comparison Operators : ==,!=,<,><=,>=
Logical Operators : &&, || , !, and, or, xor
String Operators : .= , .
Bitwise Operators : &, |, <<, >>, ~
Error Control Operators : @
Execution Operators : `ls -l`
Operator Precedence : ??????????
97. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ????????
98. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Control Structure Statement if ,else, elseif
for,foreach
while, do .. while
switch
break(for,while,switch) , continute
require,require_once,include,include_one
die(), exit()
99. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? IF Statement If (expr) statements;
If (expr) {
statements;
} else {
statements;
}
If (expr) {
statements;
} elseif {
statements;
} else {
statements;
}
????? Flowchart
?????
????????????????? a+(91-100), a(81-90), b+(71-80), b(61-70), c(51-60),f(<= 50)
????? Flowchart
?????
????????????????? a+(91-100), a(81-90), b+(71-80), b(61-70), c(51-60),f(<= 50)
100. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? For Statement for (initialization; condition; increment) {
statements;
} ???? for (expr1; expr2; expr3) statement
for (expr1; expr2; expr3) :
statements;
endfor;
foreach (array as value) {
statements;
}
????? Flow
???????????????? Help
????? Flow
???????????????? Help
101. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? While & Do Statement while (expr) {
statements;
}
while (expr) :
statements;
endwhile;
do {
statements
} while (expr);
Copy ??????????? Help Copy ??????????? Help
102. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Switch Statement One Check, Support ->String, Integer
switch ($i) {
case 1 :
statements;
break;
case 2 :
statements;
break;
default :
statements;
}
switch ($i):
case 0:
statements;
break;
default:
statements;
print "i is not equal to 0, 1 or 2";
endswitch;
103. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ??????????????????: Include & Require include() , Include_once() ,require() , require_once()
take a local file or URL as input
include() and include_once() provide a warning if the resource cannot be retrieved and try to continue execution of the program if possible
require() and require_once functions provide stop processing the page if they cannot retrieve the resource
It is best to use require_once() to include files which contain necessary code and include_once() to include files that contain content which the program can run without e.g. HTML, CSS, etc.
104. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Custom Function function fun_name(para1,para2,…) {
………
return $xx;
}
Arguments
Pass By Reference -> &$xx
Pass By Value -> $xx
include, require,require_once
105. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Built In Function Mathematical Function
Data File Function
String Function
etc. ?????????????? Function Reference
106. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Builtin Function echo , var_dump, sizeof, array, unset
107. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Date and Time functions checkdate — Validate a gregorian date/time
date — Format a local time/date
getdate — Get date/time information
gettimeofday — Get current time
gmdate — Format a GMT/CUT date/time
gmmktime — Get UNIX timestamp for a GMT date
gmstrftime — Format a GMT/CUT time/date according to locale settings
localtime — Get the local time
microtime — Return current UNIX timestamp with microseconds
mktime — Get UNIX timestamp for a date
strftime — Format a local time/date according to locale settings
time — Return current UNIX timestamp
strtotime — Parse about any english textual datetime description into a UNIX timestamp
108. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Error Handling PHP.INI ->
error_reporting = E_ALL
display_errors = On
log_errors = On , error_log = /path/to/filename
set_error_handler()
trigger_error()
E_USER_NOTICE
E_USER_WARNING
E_USER_ERROR
109. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ??????????????????
110. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Web Form
111. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Form Elements FORM - Interactive form
BUTTON - Button
FIELDSET - Form control group
LEGEND - Fieldset caption
INPUT - Form input
LABEL - Form field label
SELECT - Option selector
OPTGROUP - Option group
OPTION - Menu option
TEXTAREA - Multi-line text input
112. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? FORM Syntax
<FORM>...</FORM>
Attribute
METHOD=[ get | post ] (HTTP method for submitting form)
ENCTYPE=ContentType (content type to submit form as)
ACCEPT-CHARSET=Charsets (supported character encodings)
TARGET=FrameTarget (frame to render form result in)
ONSUBMIT=Script (form was submitted)
ONRESET=Script (form was reset)
113. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Get VS Post Method ??? GET, ????????????????????????????? page address ??? POST ???????????????
??? GET ???????????? form
??? GET ??????????????????????????? 256 ????????
yourpage.php?user=david&referrer=gowansnet&area=6
$variablename=$_POST['variable'];
$variablename=$_GET['variable'];
114. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Get Example http://yourpage.php?user=david&referrer=gowansnet&area=6
???????????????
$variablename=$_GET['variable'];
??? & ?????????????????
115. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Post Example <form name=frm1 action=‘url’ method =post >
<input type=text name= user value=david>
<input type=text name= referrer value=gowansnet>
<input type=text name= area value=6>
</form>
???????????????
$variablename=$_POST['variable'];
?????????? SUBMIT
116. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Import_request_variables bool import_request_variables ( string types [, string prefix] )
Types = 'G', 'P' and 'C' characters respectively for GET, POST and Cookie.
???? import_request_variables("gP", "rvar_");
117. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Input Validate Client Validate at Client
Server Validate at Server
Use Regular expression : “/^\d{5}$/”
^,$,+,?,*,.,[],{},(),|
118. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? What is cookie ?
?????????????? Text File ?????????????????
setcookie("totals",23);
$HTTP_COOKIE_VARS["totals"]
119. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? What is session ? A visitor accessing your web site is assigned an unique id, the so-called session id.
PHP will check automatically (if session.auto_start is set to 1) or on your request (explicitly through session_start() or implicitly through session_register()) whether a specific session id has been sent with the request.
?????????????? Memory ?? Sever
120. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Session Handling session_start — Initialize session data
session_destroy — Destroys all data registered to a session
session_name — Get and/or set the current session name
session_module_name — Get and/or set the current session module
session_save_path — Get and/or set the current session save path
session_id — Get and/or set the current session id
session_register — Register one or more variables with the current session
session_unregister — Unregister a variable from the current session
session_unset — Free all session variables
session_is_registered — Find out if a variable is registered in a session
session_get_cookie_params — Get the session cookie parameters
session_set_cookie_params — Set the session cookie parameters
session_decode — Decodes session data from a string
session_encode — Encodes the current session data as a string
session_set_save_handler — Sets user-level session storage functions
session_cache_limiter — Get and/or set the current cache limiter
121. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ?????????????
122. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? RDBMS Table
Record
Field
Key
123. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Database Step Create a database
Create User
Grant Permission
Create a table
Create Index
Create table constrain
Load data into the table
Retrieve data from the table in various ways
Backup
124. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? phpMyAdmin
125. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ???????? Password ???????
??????????????????????????????? root ??????? passw0rd ???????? ??????????????
126. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ??? Password ??? config.inc.php ???? config.inc.php ?????????? c:\AppServ\www\phpMyAdmin
???????????? Editor ??
$cfg['Servers'][$i]['password'] = ''; // MySQL password
???????
$cfg['Servers'][$i]['password'] = ‘passw0rd';
127. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ?????????????????????????????????? ????? Login ???? phpMyAdmin
MySQL connection collation ???? tis620_thai_ci
??????????????????
???????????????? train_db
??????????????????????
tis620_thai_ci
???????????
128. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ????????????? ?????????????????? train_db
???????????????? php_student ?????????????????? 4 ???????????
129. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ??????????????????????????
130. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Select Statement SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT]
[SQL_BUFFER_RESULT] [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS] [HIGH_PRIORITY] [DISTINCT | DISTINCTROW | ALL] select_expression,...
[INTO {OUTFILE | DUMPFILE} 'file_name' export_options]
[FROM table_references
[WHERE where_definition]
[GROUP BY {unsigned_integer | col_name | formula} [ASC | DESC], ...
[HAVING where_definition]
[ORDER BY {unsigned_integer | col_name | formula} [ASC | DESC] ,...]
[LIMIT [offset,] rows]
[PROCEDURE procedure_name]
[FOR UPDATE | LOCK IN SHARE MODE]]
Example
SELECT what_to_select FROM which_table WHERE conditions_to_satisfy
SELECT * FROM pet WHERE name = "Bowser";
131. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Update Statement UPDATE [LOW_PRIORITY] [IGNORE] tbl_name SET col_name1=expr1 [, col_name2=expr2, ...] [WHERE where_definition] [LIMIT #]
Example
UPDATE persondata SET age=age*2;
132. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Insert Statement INSERT [LOW_PRIORITY | DELAYED] [IGNORE] [INTO] tbl_name [(col_name,...)] VALUES ((expression | DEFAULT),...),(...),...
Example
INSERT INTO tbl_name (col1,col2) VALUES(col2*2,15);
133. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Delete Statement DELETE [LOW_PRIORITY] [QUICK] FROM table_name
[WHERE where_definition] [ORDER BY ...] [LIMIT rows]
Example
DELETE FROM table_name WHERE 1>0;
134. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? ?????????????? ????? Global level
?????????????????????????????????????????????? ???????? ??? ?????????? ???????????????????? mysql.user ???? grant all on *.* to userxx@localhost identified by ‘userxx’;
????? Database Level
??????????????????????????????? ???????? ??? ?????????? ??????????????????????????????????? mysql.db ??? mysql.host ???? grant all on dbname.* to userxx@localhost identified by ‘userxx’;
????? Table Level
????????????????????????????????????????????????? ??? ?????????? ????????????????????mysql.tables_priv ???? grant all on *.tabname to userxx@localhost identified by ‘userxx’;
????? Column Level
?????????????????????????????????????????????????????? ????????????????????mysql.tables_priv
????????????
global privileges OR (database privileges AND host privileges) OR table privileges OR column privileges
135. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Database Functions int mysql_connect(“host”,”usrer”,”pass”);
int mysql_pconnect (“host”,”usrer”,”pass”);
Int myql_create_db(“database_name”,database_connect);
int mysql_select_db(“databasename”);
int mysql_query(“query”,database_connect);
mysql_close(database_connect);
Int mysql_drop(“database_name”,database_connect);
136. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Database Functions (continue) int mysql_fetch_array(result,result_type);
int mysql_fetch_row(result);
int mysql_num_rows(result);
mixed mysql_result(result,row[,field]);
object mysql_fetch_object(result);
137. ???????????????????????????????????????????? PHP 12 - 16 ?.?. 2550 : ????? ???????? Database Functions int mysql_connect(“host”,”usrer”,”pass”);
int mysql_query(“query”,database_connect);
int mysql_db_query(“query”,database_connect);
mysql_close(database_connect);
int mysql_fetch_array(result,result_type);
int mysql_fetch_row(result);
int mysql_num_rows(result);
mixed mysql_result(result,row[,field]);
object mysql_fetch_object(result);