medoo引入使用

配置文件

use Medoo\Medoo;
$a = require 'Medoo/Medoo-1.6/src/Medoo.php';

$database = new Medoo([
	// required
	'database_type' => 'mysql',
	'database_name' => 'otc',
	'server' => 'localhost',
	'username' => 'root',
	'password' => 'root',
 
	// [optional]
	'charset' => 'utf8',
	'port' => 3306,
 
	// [optional] Table prefix
	'prefix' => 'PREFIX_',
 
	// [optional] Enable logging (Logging is disabled by default for better performance)
	'logging' => true,
 
	// [optional] MySQL socket (shouldn't be used with server and port)
	'socket' => '/tmp/mysql.sock',
 
	// [optional] driver_option for connection, read more from http://www.php.net/manual/en/pdo.setattribute.php
	'option' => [
		PDO::ATTR_CASE => PDO::CASE_NATURAL
	],
 
	// [optional] Medoo will execute those commands after connected to the database for initialization
	'command' => [
		'SET SQL_MODE=ANSI_QUOTES'
	]
]);

var_dump($database);
echo '
'
; //调用实例化的类 $res = $database->select('admins',[ 'username' ],[ 'id' => 1 ]); var_dump($res); ?>

你可能感兴趣的:(数据库)