Some PHP tips and considerations

  • 2020-03-31 21:31:27
  • OfStack

From the browser, header(location) is used to jump to another page, but in fact, PHP will still execute the code in the background, if the code behind the unsafe logic, it will simply ignore the conditions set by the developer, continue to execute the following things.
Such as:
 
if(true) 
{ 
header('location://www.jb51.net'); 
} 
file_put_contents('test.txt', 'ok'); 

In this code, a careless programmer will think header('location://www.jb51.net'); Over, in fact, the background code is still executed, so when using header(location), whether wrapped in another function or written directly, it is recommended to add exit() to verify that the program is aborted.
= = = = soap
Running a demo code today, the "Class 'SoapClient' not found" error occurred. I did some searching and needed to start the soap service, but I couldn't find soap.dll in the Windows Extensions of php.ini. At first, I thought my PHP version did not contain this DLL. Simply add extension=php_soap.dll to the Windows Extensions section and restart apache.
SSL is also not started by default. Extension =php_openssl.dll, you can put it before ";" here. Just get rid of it.
 
var_dump( $query );//Print out the results as text
$GLOBALS //Save all global variables (only on the current page)
get_defined_vars() //Returns an array of all defined variables (global variables, super global variables, etc.)
get_defined_constants() //Returns an array of all defined constants

Related articles: