如何在课堂功能中使用HTML?我想在类函数中使用HTML代码。我该怎么做?我是否需要使用xml但我不想在课堂上使用XML。那么请告诉我如何在课堂上使用HTML。我的代码更大。
error_reporting(E_ALL);
/* user class for multiple user function */
class user {
private $host = '';
private $user = '';
private $passwort = '';
private $dbname = '';
private $last_injection = '';
private $conn_id = null;
public function __construct($host, $user, $password, $dbname)
{
$this->host = $host;
$this->user = $user;
$this->passwort = $password;
$this->dbname = $dbname;
$this->connect_mysql();
return($this->conn_id);
}
答案 0 :(得分:1)
虽然我认为你用View的东西(也就是HTML)弄乱你的课程是个坏主意,但是没有什么能阻止你在课堂上创建这样的方法:
public function this_feels_wrong()
{
echo '<strong>Hello</strong> <em>World!</em>';
}
...然后将其称为$user->this_feels_wrong();
来获取:
您好 世界!
作为旁注,在您的构造函数中,当您可能要执行的操作类似于return($this->conn_id);
$this->conn_id = 1234; // How ever you determine conn_id