php API接口最基本的写法

vars[$name] = $var;
        //dump($this->vars[$name]);
    }

    public function setVariable($name, $var)
    {
        $this->vars[$name] = $var;
    }
  
    public function getHtml($template)
    {
        foreach($this->vars as $name => $value) {
            $template = str_replace('{' . $name . '}', $value, $template);
        }
 
        return $template;
    }
}
?>

你可能感兴趣的:(php API接口最基本的写法)