Processing inputs and output classes

xiaoxiao2021-03-06  60

session_start ();

Function Processvariables (& $ VAR, $ Key) {if (! get_magic_quotes_gpc ()) $ VAR = Addslashes ($ VAR);

class std {// private variables var $ in = Array (); var $ Output = ''; var $ InitFunc = NULL; var $ ProcessFunc = "ProcessVariables"; function & std ($ OutputGziped = false, $ ProcessFunc = '') {global $ _GET, $ _POST, $ _SESSION, $ _FILES, $ _COOKIE, $ _SERVER, $ _ENV, $ HTTP_GET_VARS, $ HTTP_POST_VARS, $ HTTP_SESSION_VARS, $ HTTP_POST_FILES, $ HTTP_COOKIE_VARS, $ HTTP_SERVER_VARS, $ HTTP_ENV_VARS; if ($ _ GET &&! ! $ _ POST && $ _ COOKIE) {$ _GET = & $ HTTP_GET_VARS; $ _POST = & $ HTTP_POST_VARS; $ _SESSION = & $ HTTP_SESSION_VARS; $ _FILES = & $ HTTP_POST_FILES; $ _COOKIE = & $ HTTP_COOKIE_VARS;}! if ($ OutputGziped) OB_Start ("ob_gzhandler"); else ob_start (); ob_implicit_flush (true);

IF (@function_exists ($ processFunc)) $ this-> processFunc = $ processFunc; $ in = array (); $ = array_merge ($ g,); $ = array_merge ($ in,,,,,,); IN = array_merge ($ in, $ _files); $ IN = array_merge ($ IN, $ _COOKIE); Array_walk ($ IN, "Processvariables");

$ IN = Array_Merge ($ IN, $ _ENV); $ IN = array_merge ($ in _server); $ = array_merge ($ in, $ _SESSION); $ in ['_ get'] = & $ _ get; $ in ['_Post'] = & $ _ post; $ in ['_ session'] = & $ _ session; $ in ['_ cookie'] = & $ _ cookie; $ in ['_ server'] = & $ _ server; $ this-> IN = & $ in;} function & parse_incoming () {Return $ this-> in;} function add_output ($ str) {$ this-> output. = $ str;} function do_output () {Echo $ this-> Output; OB_END_FLUSH (); Die;}}?> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------- This is a basic class of my program First, used to process input and output.

In the program

$ STD = new std (); $ = $ std-> parse_incoming;

Process all input data and some variables of the server in $ IN. I will also send some original Dongdong these days. . hope its good for U.S..

$ STD = new std (); $ = $ std-> parse_incoming;

Echo $ IN [$ key]; // $ key for your parameter name

In fact, you Print_r ($ IN); this returned structure. .

This type of intent is to use it to complete the input and output, so that the program truly OOP. (Java thought)

It is used to handle input and output, that is

For example, you are submitted: http://xxx/xx.php? ACT = ABC then you can use $ in ['Act']

As another example, you have a form, there is a text domain email that you can use $ IN ['email'] to read

There is also a cookie, and session is similar.

If you just want to read Get, use $ in ['_ get'] ['Field'] POST $ IN ['_ post'] [Field '] .........

Processvariables is a customized process for each transferred variable.

Object Oriented Programming (object-oriented programming)

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

New Post(0)