Saving output of include() to a var


/ Published in: PHP
Save to your folder(s)

I use this instead of file_get_contents() to allow the use of php-tags in the include files.


Copy this code and paste it in your HTML
  1. <?php
  2. include_once($file);
  3. $site = ob_get_clean();
  4.  
  5. print $site;
  6. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.