Photoshop CS5 official Chinese official original download PHP common depressed question answer

Source: Internet
Author: User
Answers to common depressing questions in PHP
Turn from Joy Village
Register_global defaults to off in later versions of PHP4.2
To get a variable submitted from another page:
Method One: Find the Register_global in php.ini and set it to on.
Method Two: Put this extract ($_post) in front of the receiving page, extract ($_get);(Note Extract ($_session) must have Session_Start ()).
Method Three: A read variable $a=$_get["a"]; $b =$_post["B"), this method is troublesome, but relatively safe.
PHP Code:
Ob_start ();
Session_Start ();
Echo "









Echo "
";
?>
Why do I transfer a variable to another page, I only get the first half, and all that begins with a space is lost.
PHP Code:--------------------------------------------------------------------------------
$Var = "Hello php";//modified to $var= "Hello php"; try to get what results
$post = "receive.php?" Name= ". $Var;
Header ("Location: $post");
?>
--------------------------------------------------------------------------------
Content of receive.php:
PHP Code:--------------------------------------------------------------------------------
Echo "

Echo
Echo "
";
?>
--------------------------------------------------------------------------------
The correct method is:
PHP Code:--------------------------------------------------------------------------------
$Var = "Hello php";
$post = "receive.php?" Name= ". UrlEncode ($Var);
Header ("Location: $post");
?>
--------------------------------------------------------------------------------
In the Receive page you do not need to use UrlDecode (), the variable is automatically encoded.
Specification of your SQL statement
In the table, precede the field with "'" so that there is no error due to misuse of the keyword,
Of course I do not recommend you to use keywords.
For example
$SQL = "INSERT into ' xltxlm ' (' Author ', ' title ', ' id ', ' content ', ' Date ') VALUES (' xltxlm ', ' use ', 1, ' criterion your Sql s Tring ', ' 2003-07-11 00:00:00 ') "
How do I know what functions the system supports by default
PHP Code:
--------------------------------------------------------------------------------
$arr = Get_defined_functions ();
Function php () {
}
echo "
";  
Echo "shows all the functions supported by the system, and the custom function php\n";
Print_r ($arr);
Echo "
";
?>
How to compare two dates in a few days
PHP Code:
--------------------------------------------------------------------------------
$Date _1= "2003-7-15";//can also be: $Date _1= "2003-6-25 23:29:14";
$Date _2= "1982-10-1";
$Date _list_1=explode ("-", $Date _1);
$Date _list_2=explode ("-", $Date _2);
$d 1=mktime (0,0,0, $Date _list_1[1], $Date _list_1[2], $Date _list_1[0]);
$d 2=mktime (0,0,0, $Date _list_2[1], $Date _list_2[2], $Date _list_2[0]);
$Days =round (($d 1-$d 2)/3600/24);
Echo "I have struggled $Days days ^_^";
?>
What to look for when data is put into the database and taken out to display on the page
When in storage
$str =addslashes ($STR);
$sql = "INSERT INTO ' tab ' (' Content ') VALUES (' $str ')";
When you are out of the library
$str =stripslashes ($STR);
When displayed
$str =htmlspecialchars (NL2BR ($STR));

The above describes the Photoshop CS5 official Chinese official original download PHP common depressed question answer, including Photoshop CS5 official Chinese official original download content, I hope the PHP tutorial interested friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.