3 回答

TA贡献1794条经验 获得超8个赞
print_r($request->education); //It is an array print
$str_json = json_encode($request->education); //array to json string conversion
echo $str_json; // printing json string
print_r(json_decode($str_json)); //printing array after convert json string to array
exit; // exiting further execution to check resutls

TA贡献1883条经验 获得超3个赞
在您的“ AdProfile”模型中添加属性强制转换变量,以便laravel将数组自动转换为json并将json转换为数组,
像这样
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class AdProfile extends Model
{
/**
* The attributes that should be casted to native types.
*
* @var array
*/
protected $casts = [
'education' => 'array',
];
}
- 3 回答
- 0 关注
- 1175 浏览
添加回答
举报