HYPHP2.0已经废弃1.0中的InsertAll方法 可以直接使用insert进行插入多条数据 //多条数据插入 使用多维数组即可
S('table')->insert( [
[
"user_name" => "foo",
"email" => "foo@bar.com",
"age" => 25,
"city" => "New York",
"lang [JSON]" => ["en", "fr", "jp", "cn"]
],
[
"user_name" => "bar",
"email" => "bar@foo.com",
"age" => 14,
"city" => "Hong Kong",
"lang [JSON]" => ["en", "jp", "cn"]
]
]);
单条数据插入
S('table')->insert(
[
"user_name" => "foo",
"email" => "foo@bar.com",
"age" => 25,
"city" => "New York",
"lang [JSON]" => ["en", "fr", "jp", "cn"]
]
);
|