【问题标题】:Include css content in php function在 php 函数中包含 css 内容
【发布时间】:2021-02-02 09:24:27
【问题描述】:

我需要使用 CSS 样式向用户发送电子邮件,但是当调用该函数时,只呈现电子邮件文本(参见下面的代码)

public function render(){ 
   $txt = $this->getText(); 
   //I need another echo $variable to call the css and store the css style content
   //Render the text to be sent to user email
   echo $text; 
   die();
}

基本上,电子邮件如下所示:

当它进入渲染函数时,看起来像这样:

所以基本上我需要在我的 php 函数中包含 CSS。

【问题讨论】:

    标签: php css function email send


    【解决方案1】:

    您可以在邮件正文中添加 html 标签。然后你可以把内联css放到它上面。 示例:

    <p style="background-color:#DDD;"> MESSAGE BODY </p>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-30
      • 2013-06-12
      • 2020-06-28
      • 2011-11-30
      • 1970-01-01
      • 2012-02-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多