Habe vor kurzem mit der objektorientierten programmierung [OOP - PHP] angefangen.
Und wollte mal fragen wie ihr denn so eure Verbindung's Klasse aufbaut.
Wäre das so ok? Oder kann man da noch etwas bestimmtes verbessern?
Ich bedanke mich schon mal im Voraus!
PHP: config
private $HOST = "localhost"; # Host
private $USER = "dasd"; # Username
private $PASS = "asdas"; # Password
private $DATA = "dasdas"; # Database
protected $Status; # Connection Status
private function getHost ()
{
return $this->HOST;
}
private function getUser ()
{
return $this->USER;
}
private function getPass ()
{
return $this->PASS;
}
private function getData ()
{
return $this->DATA;
}
public function getConnection ()
{
return $Connection = new MySQLi($this->HOST,$this->USER,$this->PASS,$this->DATA);
}
public function getConnectionStatus ()
{
if (mysqli_connect_error()) {
print $this->Status = 'Disconnected';
} else {
print $this->Status = 'Connected';
}
}
}
$_Config = new config();
?>
Alles anzeigen
MFG: EXCITESZZ [Justin]