如何在使用单引号的回声中使用单引号 [英] How to use single quote inside an echo which is using single quote
本文介绍了如何在使用单引号的回声中使用单引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
首先,我经历了相关的问题..尚未找到任何答案.. 我正在使用此代码显示消息
First of all, i have gone through the related questions.. haven't found any answer.. I m using this code to display a message
echo 'Here goes your message with an apostrophe S like thi's ';
我该如何工作,因为此回显内的任何引号都会破坏该语句...
How can i make this work, as any quote inside this echo will break the statement...
推荐答案
要么用反斜杠转义引号,要么使用双引号指定字符串.
Either escape the quote with a backslash, or use double quotes to designate the string.
echo 'Here goes your message with an apostrophe S like thi\'s';
echo "Here goes your message with an apostrophe S like thi's";
这篇关于如何在使用单引号的回声中使用单引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文