require_onceをオブジェクト関数で使用するにはどうした良いですか?
index.php
<?php
require_once("functions.php")
$User-> created();
?>
functions.php
<?php
class User{
public $name;
public $password;
public function __construct($name , $password) {
$this ->name = $name;
$this ->password = $password;
}
public function created() {
print "{$this->name}" ;
}
}
$User = new User ($_POST["name"] , $_POST["pass"]);
$User-> created();
?>