What's the best practice to set html attribute via PHP?

后端 未结 4 926
遥遥无期
遥遥无期 2020-11-27 06:07

When doing this job in PHP,one may meet this kind of issue:

\">...

The problem is that if

4条回答
  •  温柔的废话
    2020-11-27 06:42

    Well, before you output any text into HTML you should escape it using htmlspecialchars(). So just make sure (double) quote is correctly changed.

    Pay attention to the second parameter of that function.

提交回复
热议问题