在类中使用全局变量
$db = new DB_MySQL("localhost", "root", "", "test");
// connect to the databaseinclude_once("pagi.php");
$pagination = new pagi();$records = $pagination->get_records("SELECT * FROM `table`");class pagi {
public function get_records($q) {
$x = $db->query($q);
return $db->fetch($x);
}}狐的传说
智慧大石
SMILET