Purpose | PHP Equivalent | |
Writing HTML | print $str; | |
Form, Cookie and QueryString variables. | These variables are available automatically as global variables if you have configured the following in PHP.ini: variables_order="EGPCS" For security, I would recommend disabling register_globals (set it to OFF). Then the variables are only available in the arrays: See examples below. | |
Redirecting to another location | Header(”Location: $url”); | |
Cookie Handling | setcookie($cookiename, $newval); $avar = $_COOKIE[$cookiename]; | |
Application Variables | Not available. Can be simulated with a database. | |
Session Variables | In PHP4 or later, we mark certain variables as session variables using session_register($sessionname), and we call session_start( ) at the beginning of the .php page to restore the session variable values.Note that we pass the name of the variable, and not the variable itself into session_register( ). session_register('avar'); | |
Form Variables | $_POST[”formvar”]; $_GET[”getvar”];Alternately, GET and POST vars can be converted automatically to PHP variables. However this is a security risk if hackers are aware of the variable names used in your code. | |
Server Variables | For ISAPI modules, the server varibles are stored in the $_SERVER array. For CGI, they are stored as environment variables, available from the $_ENV array or getenv( ). An example:$_SERVER[”HTTP_HOST”] using ISAPI module $_ENV[”HTTP_HOST”] using CGI module See PHP, FastCGI and IIS for a more detailed discussion of high performance PHP on IIS. | |
Database Access | ADO can be simulated using the ADOdb database library. This PHP library emulates ADO, and is designed by the author of this article.Limitations: only supports forward scrolling read-only cursors. | |
Buffering | ob_start(); |
Sunday, May 27, 2007
PHP Objects
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment