What are the advantages of defining constants using arrays? we can see that the constant is defined using arrays in the graph. it is always so troublesome. why not write a constant directly? for example:
Define ('Attach _ MALBUM ', 'shop/member ');
How good,
It's incredible to bother the entire array.
What's more, I need to redefine the array in the graph in other files. isn't that an option?
Why don't we just get started? are these guys full of food?
Define ('shop _ SITE_URL ', $ config ['shop _ site_url']);
Reply to discussion (solution)
Is defined as an array, which is easy to print out.
For example, print_r ($ arr );
It has the following benefits:
1. Simple Aggregation
2. since it is a configuration, it is possible to modify it dynamically. for example, many frameworks can modify configuration items dynamically.
3. you may need to obtain all configurations. because of the aggregation of arrays, you can easily view all configuration items.
Defined constants cannot be modified.
$ Config array, which identifies the configuration information in this array.
You can also define the $ user array, which stores user information.
When you want to obtain user information, you will know to look for the $ user array. when you store too much data and forget the key name, you can print it out at a glance.
Especially during secondary development, others are not so painful to see the many variables you have defined.