htmlspecialchars() expects parameter 1 to be string, array given Laravel 5.6

后端 未结 3 881
眼角桃花
眼角桃花 2021-01-17 01:35

Already done a research but I don\'t find the right answer that fit my problem.

error: htmlspecialchars() expects parameter 1 to be string, array given(create.blade)

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-17 02:03

    This is not a Laravel specific error:

    in php documents if you see

    htmlspecialchars("Test", ENT_QUOTES);
    

    this function accepts, 2 parameters, first one is a string and second is an optional parameter.

    If you have an array of strings to be escaped then use foreach and escape each string

提交回复
热议问题