Some PHP tips and precautions Analysis

Source: Internet
Author: User
Tags array header soap variables
From the browser, the use of header (location) to jump to another page, but in fact, PHP will still execute the background code, if the following code has unsafe logic, then directly disregard the conditions set by the developer, continue to carry out the things behind.
Such as:
Copy Code code as follows:
if (true)
{
Header (' location:http://www.jb51.net ');
}
File_put_contents (' test.txt ', ' OK ');

In this code, a careless programmer would assume the header (' location:http://www.jb51.net '); Over, in fact, the background code is still executed, so use header (location), whether encapsulated in another function or directly written, are recommended to add exit () Confirmation program aborted.
====soap
Today ran a demo code, there was "Class ' soapclient ' not found" error. Search for a bit, need to start the SOAP service, but in the php.ini Windows extensions found no Soap.dll, initially thought my PHP version does not include this DLL, to the PHP installation directory under the EXT subdirectory looked at, found that Php_ The Soap.dll is there. That's easy, just add Extension=php_soap.dll to the Windows Extensions section and restart Apache.
SSL default is also not started, Extension=php_openssl.dll, you can put it in front of ";" Just get rid of it.
Copy Code code as follows:
Var_dump ($query);//print out the result as text view
$GLOBALS//Save All global variables (only on the current page)
Get_defined_vars ()//Returns an array of all defined variables (including global variables, super global variables, etc.)
Get_defined_constants ()//Returns an array of all defined constants


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.