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

后端 未结 8 1751
误落风尘
误落风尘 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:17

    Another way to do is is to use file_get_contents() and have a template HTML page

    TEMPLATE PAGE

    
    
    $title
    $content
    
    

    PHP Function

    function YOURFUNCTIONNAME($url){
    
    $html_string = file_get_contents($url);
    return $html_string;
    
    }
    

提交回复
热议问题