首先的回聲內,我已經通過了相關的問題了..沒有找到任何答案.. 我米使用此代碼顯示一個消息如何使用單引號,這是使用單引號
echo 'Here goes your message with an apostrophe S like thi's ';
我怎樣才能使這項工作,因爲這裏面回聲任何報價將打破聲明...
首先的回聲內,我已經通過了相關的問題了..沒有找到任何答案.. 我米使用此代碼顯示一個消息如何使用單引號,這是使用單引號
echo 'Here goes your message with an apostrophe S like thi's ';
我怎樣才能使這項工作,因爲這裏面回聲任何報價將打破聲明...
要麼逃避報價用反斜槓,或使用雙引號來指定的字符串。
echo 'Here goes your message with an apostrophe S like thi\'s';
echo "Here goes your message with an apostrophe S like thi's";
使用反斜槓將引號退出。
'hello\'s'
反斜槓後出現的單引號出現在屏幕上。
在PHP中,轉義序列字符是反斜槓(\
)。您可以在特殊字符之前添加此字符以確保這些字符顯示爲文字。例如:
echo 'Here goes your message with an apostrophe S like thi\'s ';
或者你也可以這樣寫:
echo "Here goes your message with an apostrophe S like thi's ";
echo <<<EOT
You can put what ever you want here.. HTML, " ' ` anyting will go
Here goes your message with an apostrophe S like thi's
EOT;
一定要使用這類字符串之前閱讀this。
'echo'在這裏用撇號S像'''''';' – k102 2012-08-03 09:29:28
+1 K102。你可以閱讀[that](http://php.net/manual/fr/function.echo.php),並且你想在echo函數中使用doubleQuote: echo「這是我的!」 ; – 2012-08-03 09:32:14