上一篇《替换方法:Replace API-Medoo使用指南》中介绍了如何使用Medoo的Replace方法把数据库中的旧数据替换成新的,本篇将教你使用Get方法来取得数据库中的单条记录。php
取得方法:Gethtml
取得数据库中的单条记录。数据库
get($table, $columns, $where) //table [string]: 表名 //columns [string/array]: 将要获取的数据的目标字段 //where (可选) [array]:WHERE子句筛选记录
返回值: [string/array]:返回所设定的字段的数据函数
提示:这个函数只能获取取得一条记录。
post
$database = new medoo("my_database"); $email = $database->get("account", "email", [ "user_id" => 1234 ]); // $email = "foo@bar.com" $profile = $database->get("account", [ "email", "gender", "location" ], [ "user_id" => 1234 ]); // $profile = array( // "email" => "foo@bar.com", // "gender" => "female", // "location" => "earth" // )
Medoo版本: 0.9.1.1 spa
原文标题: 取得方法:Get API-Medoo使用指南 .net
原文连接: http://loiy.net/post/591.html code