Print less-than and greater-than symbols in PHP

后端 未结 7 755
南方客
南方客 2020-12-01 16:01

I am have troubles trying to print out < > symbols in HTML using PHP.

I am appending a string \"\" to a v

7条回答
  •  一生所求
    2020-12-01 17:04

    The < and > symbols should be shown in the HTML source but the "" is interpreted as XML tag. Use htmlentities() to convert all special characters in the String into their HTML-equivalents, or use "<machine>"

    Solution:

    $output .= "  ";
    $output = htmlentites($output);
    echo $output;
    

提交回复
热议问题