获取数据的代码:
$article = DB::table('article')->where("is_show",1)
->select("id", "title", "picture", "description","link")
->inRandomOrder()->take(2)->get()->toArray();
第一次获取的数据:
array:2 [
0 => array:5 [
"id" => 220
"title" => "<p><span style="color: rgb(255, 0, 0);">半年睡200个中国女生,开房直播赚钱,洋垃圾爆红抖音</span></p>"
"picture" => "http://wl888521.cn/image_90a0e5e05ccb2b000cda874682ff69e4.gif?sign=4424f6d758089acba2df5a6c479c8e83&t=5ca321dc"
"description" => "现在有很多外国人,在本国是loser,到了中国就成了洋宝贝。一边睡着中国女孩,一边骂着fuck China。更可悲的是,有大批女孩把洋垃圾当宝,可洋垃圾只不过是把你当草。"
"link" => null
]
1 => array:5 [
"id" => 3
"title" => "老鼠原来最怕这个!角落丢一把,老鼠别想跑!轻松连窝一起端"
"picture" => "https://wechatadszmr.oss-cn-shenzhen.aliyuncs.com/common/20190321/135637-TkVUYINBbu.jpg?x-oss-process=image/resize,w_100"
"description" => "老鼠原来最怕这个!角落丢一把,老鼠别想跑!轻松连窝一起端"
"link" => null
]
]
第二次获取的数据:
array:2 [
0 => array:5 [
"id" => 167
"title" => "65岁林青霞与73岁秦汉已低调领证?!纠葛二十余载终圆满?"
"picture" => "https://wechatadszmr.oss-cn-shenzhen.aliyuncs.com/article/spid/2019-02/18/214536-gGcnqS.jpg?x-oss-process=image/resize,w_100"
"description" => "65岁林青霞与73岁秦汉已低调领证?!纠葛二十余载终圆满?"
"link" => null
]
1 => array:5 [
"id" => 74
"title" => "这项检查已被叫停 5 年,如今还有医院在给孩子做,家长千万别再上当了!"
"picture" => "https://wechatadszmr.oss-cn-shenzhen.aliyuncs.com/article/spid/2019-02/18/200951-YYKqWM.jpg?x-oss-process=image/resize,w_100"
"description" => "这项检查已被叫停 5 年,如今还有医院在给孩子做,家长千万别再上当了!"
"link" => null
]
]