php - How to store configuration settings for web app? -
I have some site metadata, I want to change ... for example, in my application, if sysadmin didn site Wants to use the "inventory" part of, it can turn it off, and it will disappear from the main site.
So I was thinking, maybe I could create a table, my database is called "meta", and put value (or tubal) there! Then, if a module is closed, then the script will update the line, and set the "module x" to 0, and I will be done with it, right?
Except that it is an overhead for a set of very awesome values (creating a complete table, maintaining, etc.) ... In fact, my solution is to move a square peg in a circular slot Sounds like
The Drupal database did not get anything, and I'm guessing they themselves use a configuration file on the server? If that's the case, then I do not know actually one. The values saved in the Cfg file can be read by the web app (for example), and I do not know how to save information to such an app file. I appreciate your insights, if you have this problem before To deal with.
I use PHP primarily.
Thanks in advance!
I have often completed this using a config array:
< Code> $ config ["admin_email"] = "Admin@mydomain.com"; $ Config ["site_name"] = "Bob's Trinket Store"; $ Config ["excluded_modules"] = array ("inventory", "user_chat");
Then you can check later:
if (! In_array ("inventory", $ config ["excluded_modules"])) {/ / List is included logic]
It is right that it is a little back in reality, it would be smart to declare clearly the included module You will then refer to config.php
to load your project and work in response to different configurations.
Where option
can be "excluded_modules" and its related value
will be "inventory, usermat" though in all sincerity, this method is slightly muddy, and In the future, you can cause some frustration.
Comments
Post a Comment