|
Server-Side PHP Programming
An Introduction with Examples |
|
Prof. David Bernstein
|
| Computer Science Department |
| bernstdh@jmu.edu |
.php extension.php file (i.e., most
HTML elements, CSS) are just inserted into the HTTP response
.php file (see below) are
executed and the output is inserted into the HTTP
response<?php and
?> (XML/XHTML style)script element
(HTML style)<? and
?>
<% and
%> (ASP style)
echo Statement:
print:
echo (i.e.,
without parentheses)printf():
Loading the PHP Classes/Functions
Insertion of the Code Fragment
$_SERVER Array:
$_SERVER Array:
["REQUEST_METHOD"] - either "GET" or
"POST"
["SERVER_PROTOCOL"]
["SERVER_NAME"]
["SERVER_PORT"]
["PATH_INFO"] and ["PATH_TRANSLATED"]
["QUERY_STRING"]
["CONTENT_TYPE"]
["CONTENT_LENGTH"]
["REMOTE_HOST"] and ["REMOTE_ADDR"]
$_GET Array:
$_POST Array:
Content-Type of
application/x-www-form-urlencoded or
multipart/form-data)
$_COOKIE Array:
setcookie() Function:
header() Function:
Content-Length)
is_null() returns true if the
parameter is
NULL
isset() returns true if the parameter
is set and not NULL
is_array(), is_bool(),
is_float(), is_int(),
is_object(), and is_string()
boolval(), floatval(), and
intval()
htmlentities()
urlencode()/urldecode() and
rawurlencode()/rawurldecode()
parse_url()
filter_var()