PHP MVC 开发,如何在视图文件中使用系统中的变量

2026年09月26日 14:07
有1个网友回答
网友(1):

    include "mytpl.class.php";
     
    $tpl=new MyTpl("./templates/", "./templates_c");
 
    $title="这是从数据库中获取的标题";
    $content="这是从数据库中获取的文章内容";
 
    $tpl->assign("title", $title);
    $tpl->assign("content", $content);
 
    $tpl->display("tpl.html");

使用方法以上: