Some PHP tips and considerations Analysis _php Tutorial

Source: Internet
Author: User
From the browser, using the 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 ignore the developer set the conditions, continue to put the following things to execute.
Such as:
Copy CodeThe code is as follows:
if (true)
{
Header (' location:http://www.jb51.net ');
}
File_put_contents (' test.txt ', ' OK ');

In this code, the careless programmer will think of the header (' location:http://www.jb51.net '); Over, in fact, the code in the background is still executed, so when using the header (location), whether it is encapsulated in another function or directly written, it is recommended to add exit () to confirm that the program is aborted.
====soap
Running a demo code today, "Class ' soapclient ' not found" error occurred. Search, need to start the SOAP service, but in php.ini Windows extensions did not find Soap.dll, initially thought that my PHP version does not contain this DLL, to the PHP installation directory of the EXT subdirectory looked, found PHP_ The Soap.dll is present. 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 CodeThe code is as follows:
Var_dump ($query);//print results as text to view
$GLOBALS//Save All global variables (only in the current page)
Get_defined_vars ()//Returns an array of all defined variables (including global variables, hyper-global variables, etc.)
Get_defined_constants ()//returns an array consisting of all defined constants

http://www.bkjia.com/PHPjc/322967.html www.bkjia.com true http://www.bkjia.com/PHPjc/322967.html techarticle from the browser, using the header (location) to jump to another page, but in fact, PHP will still execute the background code, if the following code has unsafe logic, that ...

  • 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.