我期望這是一個愚蠢的問題,但我不是最好的當涉及到PHP。我想在下面的變量中添加一個圖像,我需要做什麼?在變量中包含圖像
$usermessage =
"
Thank you for joining our mailing list
We hope to see you very soon!
\n
Address 1
Address 2
<img src="images/wbf-logo.png" />
";
我期望這是一個愚蠢的問題,但我不是最好的當涉及到PHP。我想在下面的變量中添加一個圖像,我需要做什麼?在變量中包含圖像
$usermessage =
"
Thank you for joining our mailing list
We hope to see you very soon!
\n
Address 1
Address 2
<img src="images/wbf-logo.png" />
";
使用單引號'
$usermessage = "
Thank you for joining our mailing list
We hope to see you very soon!
\n
Address 1
Address 2
<img src='images/wbf-logo.png' />
";
或添加反斜槓
$usermessage = "
Thank you for joining our mailing list
We hope to see you very soon!
\n
Address 1
Address 2
<img src=\"images/wbf-logo.png\" />
";
嘗試如下
"
Thank you for joining our mailing list
We hope to see you very soon!
\n
Address 1
Address 2
<img src=\"images/wbf-logo.png\" />
";
OR
'
Thank you for joining our mailing list
We hope to see you very soon!
\n
Address 1
Address 2
<img src="images/wbf-logo.png" />
';
魔法斜線。我用<br />
取代了\ n。
$usermessage = "Thank you for joining our mailing list
We hope to see you very soon!
<br />
Address 1
Address 2
<img src=\"images/wbf-logo.png\" />
";
試試這個,躲開了雙引號的圖像標籤
"
Thank you for joining our mailing list
We hope to see you very soon!
\n
Address 1
Address 2
<img src=\"images/wbf-logo.png\" />
";
OR
"
Thank you for joining our mailing list
We hope to see you very soon!
\n
Address 1
Address 2
<img src='images/wbf-logo.png' />
";
$usermessage = '
Thank you for joining our mailing list <br />
We hope to see you very soon!
<br />
Address 1
Address 2
<img src="images/wbf-logo.png" />';
只需添加反斜線保護雙引號,像這樣:
$usermessage = "Thank you for joining our mailing list
We hope to see you very soon!
\n
Address 1
Address 2
<img src=\"images/wbf-logo.png\" />";
你只需要添加反斜線有:
例子:
<img src=\"images/wbf-logo.png\" />;
使用單引號單引號裏面它比雙引號更快,但記得所有的事情簡直是字符串... \ n不會打破你行在HTML .. – Surace