view - execute html and PHP code into a variable -
i'm trying figure out how can execute html , php code class type controller , store result variable simulate behavior of mvc oriented frameworks, example:
i have variable called $mystic_var , want use var strange function (i don't know function is) read .php file, execute , store result $mystic_var
assume try.php has following content:
<html> <head></head> <body><?php echo "hello world"; ?></body> </html>
then execute $mystic_var = mystic_function('try.php'); , if check $mystic_var, have this:
<html> <head></head> <body>hello world</body> </html>
you can use output buffer
<?php ob_start(); ?> <html> <head></head> <body><?php echo "hello world"; ?></body> </html> <?php $output = ob_get_clean(); ?>
Comments
Post a Comment