当前位置: 代码迷 >> PHP >> PHP转义符有关问题
  详细解决方案

PHP转义符有关问题

热度:47   发布时间:2016-04-28 19:22:39.0
PHP转义符问题
标准是:
<input type="button" name="button2" id="button2" onclick="if(confirm('确定要删除?')) del_department('{$vo.id}')"  class="btnStyle" value="删除"/>
现在需要写成这样的:
echo  " <input type='button' name='button2' id='button2' onclick='if(confirm(\'确定要删除?\')) del_department(\'{$vo.id}\')'  class='btnStyle' value='删除'/>";

onclick里面的不对,不知道怎样写
------解决方案--------------------
echo  " <input type='button' name='button2' id='button2' onclick='if(confirm(\"定要删除?\")) del_department(\"{$vo.id}\")'  class='btnStyle' value='删除'/>";

------解决方案--------------------
echo  " <input type='button' name='button2' id='button2' onclick=\"if(confirm('确定要删除?')) del_department('{$vo.id}')\"  class='btnStyle' value='删除'/>";

------解决方案--------------------
浏览器中看看“源代码”不就知道了
------解决方案--------------------
实在不行用.拼接吧
  相关解决方案