tarun Posted August 13, 2007 Share Posted August 13, 2007 I Want Do Make Something Like This: $config["dir"] Which Stores The Path Of An Uploads Dir And Also A Few Others Like $config["maxfilesize"] , $config["public"] But How Would I Go About Setting Them And Reading Them... ThanX, Tarun Quote Link to comment https://forums.phpfreaks.com/topic/64742-solved-making-something-like-this-configdir/ Share on other sites More sharing options...
lemmin Posted August 13, 2007 Share Posted August 13, 2007 That is an array format. You can initialize an array like so: $config = array("dir" => "dir/", "maxfilesize" => 10000); You can put as many in there as you want. If you don't want to initialize all the values and maybe do them at runtime you can use array_push() to add new ones. Quote Link to comment https://forums.phpfreaks.com/topic/64742-solved-making-something-like-this-configdir/#findComment-322870 Share on other sites More sharing options...
Barand Posted August 13, 2007 Share Posted August 13, 2007 Create a text file "config.txt" dir=path/to/somewhere maxfilesize=200000 public=somevalue then <?php $config = parse_ini_file ('config.txt') ?> That's it. Now you can echo $config['dir']; // --> path/to/somewhere Quote Link to comment https://forums.phpfreaks.com/topic/64742-solved-making-something-like-this-configdir/#findComment-322986 Share on other sites More sharing options...
tarun Posted August 14, 2007 Author Share Posted August 14, 2007 WoW... THANKS Topic Solved Quote Link to comment https://forums.phpfreaks.com/topic/64742-solved-making-something-like-this-configdir/#findComment-323871 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.