Php 文本字段中的单引号和双引号,如何使它们可见?

Php 文本字段中的单引号和双引号,如何使它们可见?,php,html,textfield,Php,Html,Textfield,如何使单引号和双引号在文本字段中可见?从数据库检索数据。例如: //PHP code $sor = mysqli_fetch_assoc($eredmeny); $string = $sor['this_is_a_string_with_qoutes']; //HTML with PHP <input type="text" name="1" id="1" value="<?php echo $string?>"> //PHP代码 $sor=mysqli\u fetc

如何使单引号和双引号在文本字段中可见?从数据库检索数据。例如:

//PHP code
$sor = mysqli_fetch_assoc($eredmeny);
$string = $sor['this_is_a_string_with_qoutes'];

//HTML with PHP
<input type="text" name="1" id="1" value="<?php echo $string?>">
//PHP代码
$sor=mysqli\u fetch\u assoc($eredmeny);
$string=$sor[“这是一个带“qoutes”的字符串];
//HTML与PHP
printf(“”,
htmlspecialchars($string));

HTML转义数据事实上,所有数据都要输出到HTML中。看。

是的,我可以用那种方式,但是没有办法正常可见吗?没有\?@bwoebi
\
在HTML中没有任何意义!您还可以在
#&中使用它们的ascii值@deceze哦,只是混淆了标记和php对不起。
printf('<input type="text" name="1" id="1" value="%s">',
       htmlspecialchars($string));