$select = Db::name(‘table’)->whereBetween( “time” ,
s
t
a
r
t
"
,
"
.
start",".
start",".end )->select();
当然使用前要记得引入Db类哦。
s
t
a
r
t
是
区
间
值
的
开
始
,
start是区间值的开始,
start是区间值的开始,end是区间值的结尾。
time指的是表table的字段。
意思就是查询time这个字段区间值是
s
t
a
r
t
到
start到
start到end的数据。
举个栗子。
这是新建的一个ceshi表,接下来我们要查询cs字段中区间值是1到35之间。
这里是代码,可以看到我查询表ceshi的字段cs区间值在1到35之间,然后打印。
大功告成,接下来上代码!!!
public function cs()
{
d
a
t
a
=
D
b
:
:
n
a
m
e
(
′
c
e
s
h
i
′
)
−
>
w
h
e
r
e
B
e
t
w
e
e
n
(
′
c
s
′
,
′
1
′
.
′
,
′
.
′
3
5
′
)
−
>
s
e
l
e
c
t
(
)
;
d
u
m
p
(
data = Db::name('ceshi')->whereBetween('cs','1'.','.'35')->select(); dump(
data=Db::name(′ceshi′)−>whereBetween(′cs′,′1′.′,′.′35′)−>select();dump(data);
}
希望大家可以点个赞哦 !