Summary of error prone in PHP programming

time:12-02-16 forum:PHPBB forum program, plug-in collection and modification
  Reprinted from http://www.jzxue.com/wangzhankaifa/php/201102/08-6017.html

this article makes a summary of errors in PHP programming, hoping the novice can avoid it!

1: why I can't get the variable

name on one web page to another page, POST data name. Why don't you get any value when you output $name?

if you want to get a variable from another page in a later version of PHP4.2: Find register_global and set it to on.
method two: put this extract ($_POST) at the front of the receiving page; extract ($_GET); (notice extract ($_SESSION) must have Session_Start ()).
method three: one reads variable $a=$_GET[.quot; Troublesome, but safer.

2: debug your program

at runtime you must know the value of a variable. I do this to establish a document debug.php, with the following contents:
[code]Ob_Start ();
Session_Start ();
Echo.Quot;.Lt; pre.gt;.Quot; Print_R ($_POST);

Echo.Quot; the _COOKIE variable on this page is.Quot;
Print_R ($_COOKIE); .quot; c:/php.quot; and put debug.php in this folder, after
, you can include this file in every web page to see the variable name and value.
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

prev:Common in Ji'nan next:American computer room and network delay...
post comment
Notice



approved   She turned the "abnormal" into a win...   Primary school is now "adult corrupt...      Girls fight against leukemia doctors...   17 year old Chinese girls pass a com...
rand   PHPBB3 forum page plate name and fon...   The PHPBB forum automatically adds t...   PHPBB forum uploads pictures to Tiny...   The PHPBB3.0.X forum home page displ...   Large size pictures in PHPBB forum a...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com