Home  >  Article  >  Backend Development  >  Analysis of some PHP skills and precautions_PHP tutorial

Analysis of some PHP skills and precautions_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:31:42695browse

From the browser, using header(location) will jump to another page, but in fact, PHP will still execute the background code. If the code behind has unsafe logic, then just ignore the developer. The set conditions continue to be executed.
For example:

Copy code The code is as follows:

if(true)
{
header( 'location:http://www.jb51.net');
}
file_put_contents('test.txt', 'ok');

This code is careless Programmers will think that header('location:http://www.jb51.net'); is over. In fact, the background code is still executed, so when using header(location), no matter it is encapsulated in The other function is still written directly. It is recommended to add exit() at the end to confirm that the program is terminated.
====soap
When I ran a demo code today, a "Class 'SoapClient' not found" error occurred. After searching, I needed to start the soap service, but soap.dll was not found in the Windows Extensions of php.ini. At first, I thought that my php version did not contain this dll, so I went to the ext subdirectory of the php installation directory and took a look. Found that php_soap.dll exists. That's easy, just add extension=php_soap.dll to the Windows Extensions section and restart apache.
SSL is not started by default, extension=php_openssl.dll, you can just remove the ";" in front of it here.
Copy code The code is as follows:

var_dump( $query );//Print the result as text to view
$GLOBALS //Save all global variables (only in the current page)
get_defined_vars() //Return an array composed of all defined variables (including global variables, super-global variables, etc.)
get_defined_constants() //Returns an array consisting of all defined constants

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322967.htmlTechArticleFrom the browser, using header(location) will jump to another page, but in fact, PHP will still execute the background code. If the code behind has unsafe logic, then...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn