如何输出输入中引号的值


How to output the value of the quotes in the input?

我有代码

$name = 'Test world '"Example'" end';
<input type="text" name="text"  value="'.$name.'">

但在输入中的页面上的输入中,我仅看到CCD_ 1。

在furebug中,我看到输入中的完整代码:

<input type="text" name="text"  value="Test world "Example" end">

结果,我看到报价提前结束。

请告诉我如何做出正确的结果(结果应该带有引号)?

$name = 'Test world '"Example'" end';
echo '<input type="text" name="text"  value="'.htmlspecialchars($name,ENT_QUOTES).'">';

$name = 'Test world ''"Example''" end'; <input type="text" name="text" value="'.$name.'">

要么这样,要么对斜杠进行编码。