我想在我的电子邮件内容中将一些文本邮寄为粗体.我使用了以下代码
$to = 'some@gmail.com';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-Type: text/html; charset=UTF-8' . "\r\n";
$from = $param['email']; // this is the sender's Email address
$headers = "From:" . $from;
$name = $param['name'];
$subject = "Test";
$message = "message.\n\n"
."<b>Name:</b> ".$name . "\n\n"
."Adress: \n"
.$param['address'] . "\n"
.$param['zip'] . ", "
.$param['postal_area'] . "\n\n"
."E-post: ".$param['email'] . "\n\n\n"
mail($to,$subject,$message,$headers);
Run Code Online (Sandbox Code Playgroud)
我也使用了<strong>而不是<b>标签,但没有任何作用.我收到以下格式的邮件:
<b>Namn:</b> some name
Adress:
Borås, Sweden
4837, Boras
E-post: somemail@gmail.com
Run Code Online (Sandbox Code Playgroud) 我有一个内容为的数组
$VAR1 = {
'1' => 'May 05, 2011',
'0' => 'Jul 22, 2009',
'2' => 'Jun 13, 2012'
};
Run Code Online (Sandbox Code Playgroud)
我试图在催化剂模板中显示它,代码是
[% x = 0 %]
[% FOREACH mortgage IN mortgages %]
<table width=40% border=1 cellspacing="0" cellpadding="10">
<tr>
<td>Date</td>
<td><b>[% dateformat.x %]</b></td>
</tr>
</table>
[% x = x+1 %]
[% END %]
Run Code Online (Sandbox Code Playgroud)
dateformat.x应根据x的值显示2011年5月5日或2009年7月22日或2012年6月13日,但错误是它不显示任何内容.它显示一个空白.
我认为错误是数组中的键是一个字符串,而与dateformat一起使用的x的值是数字.如果我使用dateformat添加0或1,则它会正确显示([%dateformat.0%]).
我需要在Perl的Template Toolkit中舍入一个值.但我无法使用ceil().
[%interestRate = ceil(mortgage.interest_rate / 100)%]
Run Code Online (Sandbox Code Playgroud)
答案显示了一个null价值.
我使用Perl模板工具包来渲染我的数据.这是我传递给模板的哈希
'location' => {
'1' => {
'nmi' => 'QB13557343'
},
'2' => {
'nmi' => 'QB13559843'
},
},
Run Code Online (Sandbox Code Playgroud)
在模板中我循环这个哈希以获得结果,但它没有显示模板中的代码是:
[% FOREACH loc IN location %]
<p>NMI: [% loc.nmi %][% location.loc.nmi %]
[% END %]
Run Code Online (Sandbox Code Playgroud)
我尝试了loc.nmi和location.loc.nmi但没有得到任何结果.任何帮助将不胜感激.