close

[Solved] Laravel htmlspecialchars() expects parameter 1 to be string, object given in my project?

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Laravel htmlspecialchars() expects parameter 1 to be string, object given in my project? in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Laravel htmlspecialchars() expects parameter 1 to be string, object given in my project Error Occurs?

Today I get the following error Laravel htmlspecialchars() expects parameter 1 to be string, object given in my project? in php.

How To Solve Laravel htmlspecialchars() expects parameter 1 to be string, object given in my project Error ?

  1. How To Solve Laravel htmlspecialchars() expects parameter 1 to be string, object given in my project Error ?

    To Solve Laravel htmlspecialchars() expects parameter 1 to be string, object given in my project Error But best way in this case use the json_encode method in your blade and json_decode in controller.

  2. Laravel htmlspecialchars() expects parameter 1 to be string, object given in my project?

    To Solve Laravel htmlspecialchars() expects parameter 1 to be string, object given in my project Error But best way in this case use the json_encode method in your blade and json_decode in controller.

Solution 1

This is the proper way to access data in laravel :

@foreach($data-> ac as $link) 

   {{$link->url}}

@endforeach

Solution 2

You could use serialize

<input type="hidden" name="quotation[]" value="{{serialize($quotation)}}">

But best way in this case use the json_encode method in your blade and json_decode in controller.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment