前段时间开始研究swoole,swoole是一套设计非常精巧的PHP框架,可在使用时遇到些麻烦。在此请教各位大侠,swoole如何输出模板的内容,我通过如下方法输出模板无效。不知道怎么设置。还有就是GET参数中的view参数为何设置没有效果。class page extends Controller
{
function __construct($swoole)
{
parent::__construct($swoole);
}
function index()
{
$sql = "SELECT id,pname FROM people";
$res = $this->swoole->db->query($sql);
$data = $res->fetchAll();
$this->swoole->tpl->assign("title", "helloWorld");
$this->swoole->tpl->display("page.html"); }
}
{
function __construct($swoole)
{
parent::__construct($swoole);
}
function index()
{
$sql = "SELECT id,pname FROM people";
$res = $this->swoole->db->query($sql);
$data = $res->fetchAll();
$this->swoole->tpl->assign("title", "helloWorld");
$this->swoole->tpl->display("page.html"); }
}
应该在网站根目录下,templates/ 下 把你的模板文件,page.html放到这里