Execute a PHP file, and return the result as a string

前端 未结 2 1947
故里飘歌
故里飘歌 2020-12-08 22:26

Let\'s assume I have the following file - template.php:



    
        

        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-08 23:04

    This should do it:

    ob_start();
    include('template.php');
    $returned = ob_get_contents();
    ob_end_clean();
    

提交回复
热议问题