Home  >  Article  >  Backend Development  >  Analyze $GLOBALS in ecshop

Analyze $GLOBALS in ecshop

WBOY
WBOYOriginal
2016-08-08 09:32:15958browse

Some netizens who engage in ec secondary development or research ec often mention $GLOBALS['db']; $GLOBALS['ecs']; and other posts defined there in the forum. Let me tell you about $GLOBALS:
Friends who want to understand execute this code



  1. $xaphp = 'Xi'an php service center';


  2. echo $GLOBALS['xaphp'];


  3. ?>
Copy the codeof course the browser will print out Most structured
programs have so-called global variables and local variables. PHP also has the same processing method in this regard. When the PHP program is executed, the system will retain a global variable in the memory. Variable area. In actual use, you can use $GLOBALS["variable name"] to get the required variables. In
user-defined functions or programs, you can use the $GLOBALS array to get the required variables" If you open init.php in ec, you will see N $ db = New CLS_MYSQL
($ db_host, $ db_user, $ db_pass, $ db_name); The above views are my personal understanding.

The above introduces the analysis of $GLOBALS in ecshop, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.
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