加入收藏 | 设为首页 | 会员中心 | 我要投稿 南平站长网 (https://www.0599zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

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

发布时间:2022-10-17 06:31:53 所属栏目:PHP教程 来源:互联网
导读: Medoo是最近倍受关注的超轻量级PHP SQL框架,特点是超级轻量级,只有一个8KB文件,配置简单php轻框架,使用方便,而且还提供防止数据注入,调试等特性,大大提升开发效率。
此次0.8.2版本更

Medoo是最近倍受关注的超轻量级PHP SQL框架,特点是超级轻量级,只有一个8KB文件,配置简单php轻框架,使用方便,而且还提供防止数据注入,调试等特性,大大提升开发效率。

此次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

'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"

]);

官方网站:

GitHub:

(编辑:南平站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!