我想将全名显示为标题:
@section('title', ['title' => $userdetail->fullName])
我使用了上面的代码,它显示了字符串到对象转换的错误异常。
修改你的@section到此
@section('title', {{$userdetail->fullName}})
@section('title', $userdetail->fullName)
您不需要将其指定为关联数组,只需将变量和section作为此变量的值即可
这样做 -
@section('title', "$userdetail->fullName")
将第二个参数包装在双引号内,因为它呈现它会自动呈现变量和普通文本,而单引号只呈现文本而不是变量。
请记住,您不能在刀片语法中使用刀片回声{{ }}
。喜欢 - @section('title', {{ $userdetail->fullName }})