+ -
当前位置:首页 → 问答吧 → 关于swoole的使用

关于swoole的使用

时间:2011-03-30

来源:互联网

前段时间开始研究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");

  }
}

作者: amourwudi   发布时间: 2011-03-30

你的page.html不存在,会提示错误吧。
应该在网站根目录下,templates/ 下 把你的模板文件,page.html放到这里

作者: matyntc   发布时间: 2011-03-31