Equivalent relationship between php and asp objects. 1) write HTMLasp: Response. write (str) php: print $ str; echo $ str; print_r $ debug_str; 2) Form, CookieandQueryString variable asp: you can use Requestobject. php: these variables are automatically extracted. 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 my article.
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 );
Http://www.bkjia.com/PHPjc/446911.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/446911.htmlTechArticle1) write HTML asp: Response. write (str) php: print $ str; echo $ str; print_r $ debug_str; 2) Form, Cookie and QueryString variable asp: Request object can be used. php: these variables are automatically extracted...