1) write HTML
ASP: Response. Write (STR)
PHP: Print $ STR;
Echo $ STR;
Print_r $ debug_str;
2) form, Cookie and querystring variable
ASP: You can use request object.
PHP: these variables are automatically provided as a global variable, IF configured in the PHP. ini file as follows:
Variables_order = "egpcs"
Register_globals = on
For security, I will not allow register_globals (set it to Off). Then the variable is only used in the array:
$ Http_post_vars, $ http_cookie_vars and $ http_get_vars.
3) Redirecting to another location
ASP: Response. Redirect (URL)
PHP: Header ("Location: $ URL ");
4) Cookie Processing
ASP: Response. Cookies (cookiename) = newval
Avar = request. Cookies (cookiename)
PHP: setcookie ($ cookiename, $ newval );
$ Avar = $ http_cookie_vars [$ cookiename];
5) Application variable
ASP: Application (appvarname)
PHP: No. It can be simulated using a database.
6) Session Variables
ASP: Session (sessionname) = newval
Avar = SESSION (sessionname)
PHP: In PhP4 or later versions, we determine that the variable is used as a session in
Session_register ($ sessionname). Then, we call session_start ()
Resume the session variable value on the. PHP page.
For example:
Session_register ('avar ');
$ Avar = 99;
Session_start ();
Print $ Avar;
7) form variable
ASP: request. Form ("formvar ")
Request. querystring ("getvar ")
PHP: $ http_post_vars ["formvar"];
$ Http_get_vars ["getvar"];
The get and post variables can be automatically modified to the PHP variables alternately, Which is unsafe.
8) server Variables
ASP: There are many server variables. You can refer to the ASP document for an example:
Request. servervariables ("http_host ")
PHP: As the ISAPI mode, server variables are stored in the $ http_server_vars array.
As CGI, they are stored in environment variables, using the $ http_env_vars array or getenv ()
. Example:
$ Http_server_vars ["http_host"] Using ISAPI Module
$ Http_env_vars ["http_host"] Using CGI Module
9) Database Access
ASP: ADO technology
PHP: Ado can be simulated using the ADODB library, which is equivalent to ADO.
The limit is that read-only and roll-forward cursors are currently supported.
(Annotation) You can also directly call the com library to view myArticle.
10) Buffering
ASP: Response. Buffer = true
Response. Write ("ABC ");
Response. Flush ()
PHP: ob_start ();
Print "ABC ";
Ob_end_flush ();
11) script timeout
ASP: seconds:
Server. scripttimeout (240)
PHP: seconds:
Set_time_limit (240 );
The translation above is not good. Please forgive me!