当前位置:Gxlcms > PHP教程 > 类中调用自定义方法如何会Fatalerror:Calltoundefinedfunction

类中调用自定义方法如何会Fatalerror:Calltoundefinedfunction

时间:2021-07-01 10:21:17 帮助过:5人阅读

类中调用自定义方法怎么会Fatal error: Call to undefined function

class Template{

private $html;
public $return;

function __construct($html)
{
$this->html = $html;

}

function cuts($text,$left,$right)
{
$re = rtrim(substr($text,$left,$right-$left));
return $re;
}

function conver()
{
$field_left = strpos($this->html,"}}") + 2;
$field_right = strpos($this->html,"{{endlist}}");
$tagin = cuts($this->html,$field_left,$field_right);
print $tagin;
$param_left = strpos($this->html,"((") + 2;
$param_right = strpos($this->html,"))");
$param = cuts($this->html,$param_left,$param_right);
print $param;

}

}


Fatal error: Call to undefined function cuts()

为毛会出现这种情况
------解决方案--------------------
$param = $this->cuts($this->html,$param_left,$param_right);

人气教程排行