注意:如果这是一个非常简单的问题,我很抱歉,但我有点强迫我的代码格式
我有一个类,它有一个函数,它返回一个字符串,该字符串将构成电子邮件的正文。我想要这个文本格式,这样它看起来在电子邮件中是正确的,但也这样它不会使我的代码看起来很奇怪。我的意思是:
class Something
{
public function getEmailText($vars)
{
$text = 'Hello ' . $vars->name . ",
The second line starts two lines below.
I also don't want any spaces before the new line, so it's butted up against the left side of the screen.";
return $text;
}
}
但也可以写成:
public function getEmailText($vars)
{
$text = "Hello {$vars->name},\n\rThe second line starts two lines below.\n\rI also don't want any spaces before the new line, so it's butted up against the left side of the screen.";
return $text;
}
但是,新航线和运费返还有什么关系呢?有什么区别?\n\n是否等同于\r\r或\n\r?当我在线条之间创建线间距时,我应该使用哪一个?在
然后是输出缓冲和heredoc语法选项
如何处理在对象中使用长多行字符串的问题?在