Medoo 0.8.2更新,超轻量级的PHP SQL框架
jopen 11年前
Medoo是最近倍受关注的超轻量级PHP SQL框架,特点是超级轻量级,只有一个8KB文件,配置简单,使用方便,而且还提供防止数据注入,调试等特性,大大提升开发效率。
此次0.8.2版本更新了建立初始化连接的方法,提供更加灵活的接口以应用在各种不同的应用当中。
// Independent configuration require 'medoo.php'; $database = new medoo([ // required 'database_type' => 'mysql', 'database_name' => 'name', 'server' => 'localhost', 'username' => 'your_username', 'password' => 'your_password', // optional 'charset' => 'utf8', // driver_option for connection, read more from http://www.php.net/manual/en/pdo.setattribute.php 'option' => [ PDO::ATTR_CASE => PDO::CASE_NATURAL ]; ]); $database->insert("account", [ "user_name" => "foo", "email" => "foo@bar.com" ]); // Or just open the medoo.php and edit some configuration on the top of the file, // So that you can use it directly without configure again in the further. // For MySQL, MSSQL, PostgreSQL, Sybase type name // MySQL -> mysql // MSSQL -> mssql // PostgreSQL -> pgsql // Sybase -> sybase class medoo { protected $database_type = 'mysql'; // The type name of database protected $server = 'localhost'; protected $username = 'your_username'; protected $password = 'your_password'; // Optional protected $charset = 'utf8'; .... // And get started! require_once 'medoo.php'; $database = new medoo('my_database'); $database->insert("account", [ "user_name" => "foo", "email" => "foo@bar.com" ]);
官方网站:http://medoo.in
GitHub:https://github.com/catfan/Medoo