包含文件中如何正确使用功能?

用户名

再会。

我们有3个文件:

1)index.php

<?php
require_once("functions.php");
$t= new getgunctions;
$t->getgainTpl();
$t->controllerTpl(1);
?>

2)functions.php

<?php
class getgunctions{
  .....
  public function controllerTpl(){
    $this->form();
  }
  private function form(){
    include "form.tpl";
  }
  public function right(){
    echo 'test';
  }
  .....
}

?>

3)form.tpl

<div><?php $this->right(); ?></div>

但我得到错误: Using $this when not in object context...

请告诉我right();在form.tpl中如何正确使用函数

里奥·洛基(Leo Loki)

检查服务器上的文件。如果您在function.php中没有错误,那就可以了

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章