What is the best way to echo results from the database into html code in PHP?

后端 未结 5 1940
伪装坚强ぢ
伪装坚强ぢ 2021-01-15 05:04

when I have a value like this in the database (\"foo\")

how can I echo it without any conflict with html code

notice



        
5条回答
  •  鱼传尺愫
    2021-01-15 05:41

    You can use htmlentities to overcome this problem like so:

    " />
    

    this will return

    
    

    avoiding any conflict with html.

提交回复
热议问题