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
$xaphp = 'Xi'an php service center';
-
echo $GLOBALS['xaphp'];
?>-
Copy the code
of 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.