Jump to content

[SOLVED] accessing data in conf class (prob something simple)


CaptainChainsaw

Recommended Posts

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');
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.