特殊字符的问题

Proplem with special characters

各位, 我对特殊字符有疑问。 我将不得不用一个数组创建许多条目,并且有像这样的特殊字符 " 和 ' 。 如果我把它放在这样的输入中,它就会显示出来。

<input type="text" class="form-control" placeholder="" value="&quot;A&quot; Cell Incubator">

但是如果我使用"str_replace"来帮助,什么也没有显示。

    <?php
 $suche  = array("&quot;");
 $ersetze = array('"');
 $text  = "&quot;A&quot; Cell Incubator";
 $texts  = "&quot;A&quot; Cell Incubator";
?>
<ul class="">
 <li><h1>Sonderzeichen "</h1>
  <ul class="">
   <li><?php echo str_replace($suche, $ersetze, $text); ?></br>
    <input type="text" class="form-control" placeholder="" value="<?php echo str_replace($suche, $ersetze, $text); ?>"></li>
  </ul>
 </li>
</ul>

我的目标是显示输入中特殊字符的 HTML 代码。

尝试使用htmlentities:

<ul class="">
    <li><h1>Sonderzeichen "</h1>
        <ul class="">
            <li><?php echo str_replace($suche, $ersetze, $text); ?></br>
                <input type="text" class="form-control" placeholder="" value="<?php echo htmlentities($text); ?>"></li>
        </ul>
    </li>
</ul>