使用php

时间:2017-10-12 17:11:25

标签: php

可能是下面打印数据的最佳方式,因为我的单引号插入了双引号

echo '
<div class=" w3-display-container">
  <span onclick="this.parentElement.style.display='none'"
  class="w3-button w3-gray w3-large w3-display-topright">&times;</span>


<div id='alerts_create_room' class='w3-panel w3-red'>No Data Found for the Search Group.</div></div>';

2 个答案:

答案 0 :(得分:0)

echo '
<div class=" w3-display-container">
  <span onclick="this.parentElement.style.display=\'none\'"
  class="w3-button w3-gray w3-large w3-display-topright">&times;</span>


<div id=\'alerts_create_room\' class=\'w3-panel w3-red\'>No Data Found for the Search Group.</div></div>';

或者:

echo '<div class=" w3-display-container">
  <span onclick="this.parentElement.style.display=none"
  class="w3-button w3-gray w3-large w3-display-topright">&times;</span>


<div id="alerts_create_room" class="w3-panel w3-red">No Data Found for the Search Group.</div></div>';

答案 1 :(得分:0)

在每个“单引号”中给出反斜杠“\”

<span onclick="this.parentElement.style.display=\'none\'" class="w3-button w3-gray w3-large w3-display-topright">&times;</span>

<div id=\'alerts_create_room\' class=\'w3-panel w3-red\'>