I bought a PHP Design Patterns book, and the author uses constants to hold connection attributes:
interface IConnect {
const HOST = "localhost";
const UNAME = "root";
const PW = "jerrylewis99";
const DBNAME = "test";
public function doConnect();
}
I know this works, but is it correct and usable? What are your thoughts and why do you believe so?
Aucun commentaire:
Enregistrer un commentaire