CaptainChainsaw Posted July 14, 2008 Share Posted July 14, 2008 Hi all, I can't access the config data in my conf class for some reason, it's prob somethin really simple but I can't seem to get the conf values echoing out to the browser. Anyone got any suggestions? Here's my PHP5 code: Thanks in advance CC <?php class conf{ private $_confdata=array( // database conf "dbhost" => "host", "dbusername" => "username", "dbpassword" => "password", "dbname" => "dbname" // templates ); public function getConfItem($key){ return $_confdata[$key]; } } ?> in my php script I've got: <?php require_once('class.conf.php'); $conf=new conf(); echo "dbhost: ".$conf->getConfItem('dbhost'); ?> Link to comment https://forums.phpfreaks.com/topic/114735-solved-accessing-data-in-conf-class-prob-something-simple/ Share on other sites More sharing options...
trq Posted July 14, 2008 Share Posted July 14, 2008 return $this->_confdata[$key]; Link to comment https://forums.phpfreaks.com/topic/114735-solved-accessing-data-in-conf-class-prob-something-simple/#findComment-589995 Share on other sites More sharing options...
CaptainChainsaw Posted July 15, 2008 Author Share Posted July 15, 2008 Thank you, problem solved Link to comment https://forums.phpfreaks.com/topic/114735-solved-accessing-data-in-conf-class-prob-something-simple/#findComment-590950 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.