Is there any way to return HTML in a PHP function? (without building the return value as a string)

后端 未结 8 1720
误落风尘
误落风尘 2020-12-12 11:55

I have a PHP function that I\'m using to output a standard block of HTML. It currently looks like this:


          


        
8条回答
  •  时光说笑
    2020-12-12 12:24

    If you don't want to have to rely on a third party tool you can use this technique:

    function TestBlockHTML($replStr){
      $template = 
       '
         
           

    $str

    '; return strtr($template, array( '$str' => $replStr)); }

提交回复
热议问题