-2
中的双引号内使用单引号解决我由于双引号内的单引号引起错误,并且所有内容都位于$ content变量的单引号内。请问这怎么解决?
$content = '
setTimeout("finishAjax('usernameResult', '"+escape(response)+"')", 400);
';
中的双引号内使用单引号解决我由于双引号内的单引号引起错误,并且所有内容都位于$ content变量的单引号内。请问这怎么解决?
$content = '
setTimeout("finishAjax('usernameResult', '"+escape(response)+"')", 400);
';
为了在字符串文字中放置单引号或双引号,必须首先将其转义。 PHP中的转义字符是反斜线(\)。
$content = "setTimeout(\"finishAjax('usernameResult', '+escape(response)+')\", 400);";
阅读更多关于转义字符HERE。
转义引用 –
$ content =“setTimeout(\”finishAjax('usernameResult','escape(response)')\“,400)”; – Programit
嗨周杰伦,谢谢你的回复。但是,它仍然在第105行的C:\ xampp \ htdocs \ fm-reg \ register.php中显示错误“Parse error:syntax error,unexpected'usernameResult'(T_STRING);” – jbm59er