我已經分隔與PHP類的幾個文件,現在我需要讓他們在一起,在一個函數是這樣的:PHP函數調用另一個類
include("require-class.php");
require_multi("db-class.php", "settings.php","users-class.php");
class ajaxLogin {
private $settings;
private $users;
public function __construct(settings $settings, users $users) {
$this->settings = $settings;
$this->users = $users;
}
}
global $ajaxLogin;
$ajaxLogin = new ajaxLogin;
在settings.php
類名爲設置和一個在users-class.php
是用戶。我得到了一個錯誤:
PHP Catchable fatal error: Argument 1 passed to ajaxLogin::__construct() must be an instance of settings, none given, called in /var/www/html/idcms/admin/class/login-ajax.php on line 47 and defined in /var/www/html/idcms/admin/class/login-ajax.php on line 13, referer: http://localhost/idcms/admin/
你如何調用這個類實例? – AnkiiG