你好,游客 登录 注册 搜索
背景:
阅读新闻

Medoo 0.8.2更新,超轻量级的PHP SQL框架

[日期:2013-05-28] 来源:oschina.net  作者:Linux [字体:大 中 小]

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

linux
相关资讯       Medoo 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款