PHP - templating with custom tags - is this a legit use of eval?

前端 未结 3 832
南方客
南方客 2021-01-06 02:03

Overview

Around the end of 2009, I wrote a simple templating system for PHP/HTML to be used in-house by our designers for brochure-ware type website

3条回答
  •  长情又很酷
    2021-01-06 02:42

    Yes, instead of eval, you can do what zend and other major frameworks do, use output buffering:

    ob_start();
    include($template_file); //has some HTML and output generating PHP
    $result = ob_get_contents();
    ob_end_clean();
    

提交回复
热议问题