moisesbr Posted August 15, 2013 Share Posted August 15, 2013 Hi Is there an example how to put a variable in a ini.file to use it in several pages of my site ? Moises Quote Link to comment https://forums.phpfreaks.com/topic/281212-fileini/ Share on other sites More sharing options...
requinix Posted August 15, 2013 Share Posted August 15, 2013 How to Ask Questions the Smart Way What variable? What INI file? What pages? Explain. Quote Link to comment https://forums.phpfreaks.com/topic/281212-fileini/#findComment-1445196 Share on other sites More sharing options...
.josh Posted August 15, 2013 Share Posted August 15, 2013 include or require Quote Link to comment https://forums.phpfreaks.com/topic/281212-fileini/#findComment-1445197 Share on other sites More sharing options...
moisesbr Posted August 15, 2013 Author Share Posted August 15, 2013 How to Ask Questions the Smart Way What variable? What INI file? What pages? Explain. OK. Is .ini files the right choice the store variables to use them in a whole site and pass them from a page to another. Or global variables is a different concept ? Moises Quote Link to comment https://forums.phpfreaks.com/topic/281212-fileini/#findComment-1445204 Share on other sites More sharing options...
AbraCadaver Posted August 15, 2013 Share Posted August 15, 2013 I would just use a PHP file with PHP variables or possibly an array. Include this file when you need it and use the variables as usual. Quote Link to comment https://forums.phpfreaks.com/topic/281212-fileini/#findComment-1445205 Share on other sites More sharing options...
.josh Posted August 15, 2013 Share Posted August 15, 2013 perhaps you are looking to use session variables instead? Quote Link to comment https://forums.phpfreaks.com/topic/281212-fileini/#findComment-1445207 Share on other sites More sharing options...
Barrikor Posted August 15, 2013 Share Posted August 15, 2013 OK. Is .ini files the right choice the store variables to use them in a whole site and pass them from a page to another. Or global variables is a different concept ? Moises - Global variables are the normal variables in your PHP file not hidden inside a function or class or array. - Session variables are for saved to the session and passed between pages for the same user only. - If you want variables that are on every page for every user, put the variables in a PHP file and include() them, or include_once(), if you want an error to happen if that file fails to load use require() or require_once() - Anything more complicated then that, look at using a database Quote Link to comment https://forums.phpfreaks.com/topic/281212-fileini/#findComment-1445209 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.