For example I have file config.php:
$host = 'localhost';
$db = 'logger';
$user = 'user';
$pwd = 'pass';
and file mysqlClass.php
class mysql{
public function connect(){
//hot get get variables form confing.php there ?
}
}
And I not know hot to get variables from confin.php in mysql class, I can't change config.php file
Just require_once()
the file
public function connect() {
require_once 'config.php';
// ...code...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With