我如何使用PHP真正显示它?
$answer=<script>alert(It converts to HTML.)</script>
echo "The function is: htmlspecialchars ($answer)."
答案 0 :(得分:0)
对你的问题更加苛刻。这个脚本你想要什么?你对php的问题是什么?
$answer = "<script>alert(It converts to HTML.)</script>"
echo "The function is: htmlspecialchars (". $answer .")." //something like this? or htmlspecialchars is a php function?
答案 1 :(得分:0)
$answer = "<script>alert(It converts to HTML.)</script>"
echo "The function is: htmlspecialchars".$answer;
答案 2 :(得分:0)
$variable = <<<'EOS'
$answer=<script>alert(It converts to HTML.)</script>
echo "The function is: htmlspecialchars ($answer)."
EOS;
echo htmlspecialchars($variable);
这将完全按照您键入的内容显示消息。