The equation of PHP and ASP objects

xiaoxiao2021-03-06  40

The equation of PHP and ASP objects

Add time: 2004-6-17 14:55:00

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 the request object. PHP: These variables are automatically provided as a global variable if they are configured in the php.ini file:

Variables_order = "egpcs" register_globals = ON

For safety, I will not allow register_global. It is only used in arrays: $ 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 Variables ASP: Application (AppVarName) PHP: Not available, you can use database simulation

6) session variables ASP: session (sessionname) = newval avar = session (sessionname)

PHP: In the PHP4 or later version, we determine the variable as a session in session_register ($ sessionname), then we call session_start () to start using .php page Recover session variable value.

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"];

Get and post variables can be alternately modified to PHP variables, which is an unsafe method.

8) Server variables ASP: This has many server variables, you can see the ASP document. One example:

Request.ServerVariables ("http_host")

PHP: As the ISAPI mode, server variables are stored in the $ http_server_vars array. As the CGI, they are stored in an environment variable, with a $ http_env_vars array or getENV () can be obtained. one example:

$ Http_server_vars ["http_host"] Using Isapi Module

$ Http_env_vars ["http_host"] USING CGI Module

9) Database Access ASP: Generally used ADO technology PHP: ADO can use AdoDB library to simulate, this library is equivalent to ADO. Limit is that read-only cursor and front roller is currently supported. (Annotation) can also call COM libraries Look at 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: Time level is the second: server.scripttimeout (240)

PHP: Time level is the second level: set_time_limit (240);

The above translation is not good, please forgive!

转载请注明原文地址:https://www.9cbs.com/read-57337.html

New Post(0)