Home  >  Article  >  Backend Development  >  PHP语句,多重引号问题

PHP语句,多重引号问题

WBOY
WBOYOriginal
2016-06-23 14:00:521865browse

双引号里面有单引号,单引号里面还需要引号怎么办?
echo   "";  onclick里面的单引号里面还要加引号,怎么办


回复讨论(解决方案)

有多重解决方案
1. 转义
2. 拼接符。就是 .号
3.heredoc语法。

$a = '1';echo '<input type="button" value="完成" onclick="trunTo(\''.$a.'\')"/>';echo "<input type='button' value='完成' onclick='trunTo(\"".$a."\")'/>";

echo   "<input type='button'  class='btnStyle' name='button' id='sbutton' onclick=\"location.href='__URL__/edit?id={$s.uid}&'\" value='完成'/>";
 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn