【发布时间】:2019-02-26 09:23:04
【问题描述】:
在我的 Laravel 应用程序中,我尝试仅在一个元素内访问数组中的文本,但它给了我错误。
$account_id = DB::select('select id from chart_of_accounts where type =\'Expense\' LIMIT '.$request->account_id.',1;');
return $account_id[0];
错误信息:
The Response content must be a string or object implementing __toString(), "object" given.
如果我全部退回:
return $account_id;
输出:
[{"id":19}]
我不知道如何将这个数组转换为单个字符串?
【问题讨论】: