亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

從數組中刪除雙引號

從數組中刪除雙引號

PHP
鳳凰求蠱 2021-10-22 13:25:10
我WhereIn()在 Laravel 中使用方法來獲取各種“id”,但問題是我得到的數據是這樣的["6,19"],我期望的是一個沒有雙引號的數字數組。我得到的數據來自 varchar 字段,所以它作為 varchar 出現,現在我需要將其更改為 [6,19] 而不用雙引號。請指導我這樣做。該whereIn方法僅支持帶數字的數組。public function getusers($id){    $users = User::where('member_id', $id)->get();    foreach($users as $user)    {        $s = $user->path;        $s = str_replace('/', ',', $s); //this gives 6,19 and if i wrap that with [] it gives us ["6,19"].        return $usergs = User::whereIn("id", [$s])->get(); //[$s] gives like ["6,19"] -but i need to change that as [6,19] (array not string)    }}
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 406 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號