我正在設計我的html電子郵件,這些都是包含變量的html塊,我可以將其存儲在$ template變量中。創建PHP模板的方法(即帶變量的html)?
我的問題隨存儲在變量部分。把我所有的html加入到php中,這使得它在工作中變得非常痛苦。
例如,下面的代碼是罰款,一個簡單的電子郵件,但一旦我開始變得嵌套表等它要得到真正的混亂...
$template.= 'Welcome ' . $username . '<br /><br /><br />';
$template.= 'Thank-you for creating an account <br /><br />';
$template.= 'Please confirm your account by click the link below! <br /><br />';
$template.= '<a href="' . $sitepath . '?email=' . $email . '&conf_key=' . $key . '" style="color: #03110A;"><font size="5" font-family="Verdana, Geneva, sans-serif" color="#03110A">' . $key . '</font></a>';
$template.='</body></html>';
有沒有辦法我仍然可以保存HTML中的$ VAR,但不必寫這樣的?
哦那是什麼?我會查找它! – Haroldo 2010-05-25 14:46:37
是什麼? http://www.phpf1.com/tutorial/php-heredoc-syntax.html – Haroldo 2010-05-25 14:48:10
@Haroldo,正好! – 2010-05-25 16:57:37