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 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. 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 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 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
Archived
This topic is now archived and is closed to further replies.