artemmelnik / devstart-db
该包最新版本(0.2)没有可用的许可证信息。
0.2
2018-08-20 13:05 UTC
This package is not auto-updated.
Last update: 2024-09-24 19:40:53 UTC
README
- 安装
composer require artemmelnik/devstart-db
- 使用
选择
<?php require_once __DIR__ . '/vendor/autoload.php'; use DevStart\Database; $db = new Database([ 'host' => 'localhost', 'dbname' => 'devstart_db', 'user' => 'root', 'password' => 'root', 'charset' => 'utf8' ]); $query = $db->query('SELECT * FROM posts ORDER BY id DESC'); $db->closeConnection();
### 插入
<?php $insert = $db->query("INSERT INTO posts (title, content) VALUES (:title, :content)", [ 'title' => 'Hello World', 'content' => 'Wrire content' ]);