php render_to_string

Function:

function render_to_string( $file, $context = array() ){
    if( ! file_exists( $file ) ){
        return "";
    }

    ob_start();
    include( $file );
    $cnt = ob_get_clean();

    return $cnt;
}

Example:
http://www.softwarematrix.cn/example/php.render_to_string/

You can download the test code from the example.

This entry was posted in PHP and tagged , . Bookmark the permalink.


One Response to php render_to_string

  1. Boa noite amigos, provavelmente enviar um SMS gratuito está cada vez mais custoso devido ao bloqueio das operadoras de celular. Há ainda os serviços que prometem entregar meu SMS mas nem sempre chegam recepiente final. Alguns como o Mundo oi e o Oi Torpedo funcionam mas e para as outras operadoras? E os que dizem que enviam e nada chega. Para onde está indo as meus torpedos? E para a Tim, Vivo? Alguma Idéia? Ou significa ter de comprar?. Foi mal, realmente está difícil achar serviços para enviar SMS de graça.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>