0

.phtmlメールを送信するために、内部の背景画像をエコーし​​ようとしています。

しかし、私は見積もりに問題があります。画像は表示されていません。

<?php echo '
    Plataforma <a href="http://xxxx.com/">http://xxxx.com/</a>
    <br>
    <div style="width:220px; height:30px; background-color:black; background-repeat: no-repeat; background-image:url("http://www.inova-ria.pt/images/UebeImg/Thumb/Img_153_363_T.jpg")"></div>
'
?>

IDEはこのコードが正しいことを検証しますが、送信される電子メールには画像が表示されません。

4

5 に答える 5

1
<?php echo '
    Plataforma <a $href="http://xxxx.com/">http://xxxx.com/</a>
    <br>
    <div $style="width:220px; height:30px; background-color:black; background-repeat: no-repeat; background-image:url(\"http://www.inova-ria.pt/images/UebeImg/Thumb/Img_153_363_T.jpg\")"></div>
    '
?>

スタイル属性の値は二重引用符で囲まれているため、内部の二重クォータはエスケープする必要があります。

于 2012-10-25T11:58:48.723 に答える
1

これを変更する必要があります:

background-image:url("http://www.inova-ria.pt/images/UebeImg/Thumb/Img_153_363_T.jpg")

に:

background-image:url('http://www.inova-ria.pt/images/UebeImg/Thumb/Img_153_363_T.jpg')

二重引用符は、DOMを間違った場所で切断し、誤読を引き起こしています。

于 2012-10-25T11:59:03.830 に答える
0

CSSが無効です。この行を変更します。

background-image:url("http://www.inova-ria.pt/images/UebeImg/Thumb/Img_153_363_T.jpg")

このように読むには:

background-image:url('http://www.inova-ria.pt/images/UebeImg/Thumb/Img_153_363_T.jpg')

これはstyle=""属性内にあるため、background-image行の "記号は、画像のパスではなく、style属性の終わりを示しています。

于 2012-10-25T11:58:33.457 に答える
0

画像の URL で次のように、単一エスケープ引用符を使用してみてください。

<?php echo '
    Plataforma <a href="http://xxxx.com/">http://xxxx.com/</a>
    <br>
    <div style="width:220px; height:30px; background-color:black; background-repeat: no-repeat; background-image:url(\'http://www.inova-ria.pt/images/UebeImg/Thumb/Img_153_363_T.jpg\')"></div>
'
?>
于 2012-10-25T11:59:36.367 に答える
0

他の回答はどれも問題を解決しませんでした(gmail、hotmail)。これはうまくいきます

<?php echo '
    Plataforma <a href="http://xxxx.com/">http://xxxx.com/</a>
    <br>
    <div style="width:220px; height:30px; background-color:black;">
        <img src="http://www.inova-ria.pt/images/UebeImg/Thumb/Img_153_363_T.jpg">
    </div>
    '; ?>
于 2012-10-25T13:17:35.910 に答える