Ravindra24.com

htmlspecialchars() expects parameter 1 to be string, object given (view: c:\xampp\htdocs\blog1\resources\views\email-verification.blade.php)

I am using a blade file called email-verification.blade.php to send laravel emails and when i run this file the following errors comes on the browser

htmlspecialchars() expects parameter 1 to be string, object given

I am not getting any solution please provide me the solution.

Answer

It’s looking that you are using wrong syntax under the blade file if you are using an array and you want to use the value of that array under your email blade file. You can use the following syntax for that.

Controller File

 $data=['name'=>$request->name,'token'=>$users->remember_token]; 

E-mail Blade file

 <!DOCTYPE html>
<html lang="en">
<head>
	
</head>
<body>
<b>Hi {{$name}},</b>

<p>Please verify your email id by <a href="{{asset('')}}email-verification/{{$token}}">clicking here</a></p>

<b>Thank You !</b>
</body>
</html> 

Leave a Comment