method for creating PHP templates (ie html with variables)?

后端 未结 6 516
北恋
北恋 2021-02-04 21:22

I\'m designing my html emails, these are to be a block of html containing variables that i can store in a $template variable.

My problem comes with the storing in the va

6条回答
  •  醉话见心
    2021-02-04 21:44

    you can use double quote, Heredoc, or Newdoc.

    for example (double quoted strings):

    $template.= "Welcome $username 


    Thank-you for creating an account

    Please confirm your account by click the link below!

    ${key} ";

    or (Heredoc)

    $template = <<

    Thank-you for creating an account

    Please confirm your account by click the link below!

    ${key} EOL;

    See http://php.net/manual/en/language.types.string.php For different methods of handling variables in strings.

提交回复
热议问题