【发布时间】:2020-04-30 06:25:53
【问题描述】:
我需要在数组中获取没有字符串的值。这将是字段的名称:
static function showCust(){
$table = DB::table("dummy_db.customer")->select("*")->paginate(10);
$getFieldName = ["CUST_NAME", "CUST_CITY"];
foreach($table as $items){
$a[] = $items->$getFieldName[0];
}
dd($a);
}
但结果:
ErrorException
Array to string conversion.
【问题讨论】:
标签: php laravel eloquent laravel-7