返回

PHP 8.1.3 为什么方法调用在调用时无法启动?

发布时间:2022-09-10 18:43:42 335
# 后端

我正在尝试为我的站点创建一个 MVC 模板,并且正在测试身份验证代码。屏幕或日志文件上没有显示错误,但是代码没有完成。当我尝试调用 findUser() 时,它就死了。

当我从身份验证控制器调用关联的类/方法时,什么也没有发生。这是该区域的代码。请注意回显语句,以及我如何从未得到“开始:tAuthentication - findUser 方法”

我正在使用 PHP 8.1.3_1 和最新版本的 Apache。

    # File: InitializeMVC.php
require_once CORE_PATH . 'Database.php';


# File: AuthenticationControl.php
require_once MODEL_PATH . 'tAuthentication.php';

class Authentication {
   public object $AuthenticationModel;
        
   public function __construct(){
      echo "Begin: AuthenticationControl | construct: " .  " 
"; $AuthenticationModel = new tAuthentication; } public function login() { echo "Begin: AuthenticationControl | login: " . "
"; $data['Uname'] = "testuser"; echo "Data loaded. Go to model.
"; $userid = $AuthenticationModel->findUser($data['Uname']); echo "Return to AuthenticationControl with userid.
"; } } # File: tAuthentication.php class tAuthentication extends Database { public function __construct() { echo "Begin: AuthenticationModel | construct: " . "
"; $this->db = new Database; public function findUser($username){ echo "Begin: tAuthentication - findUser method
"; $this->db->query('SELECT PeopleID FROM vAuthenticate WHERE username = :username OR email = :username'); $this->db->bind(':username', $username); $row = $this->db->GetData(); } } # Begin: AuthenticationControl | construct: # Begin: tAuthentication | construct: # Begin: AuthenticationControl | login: # Data loaded. Go to model.
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(1)
按点赞数排序
用户头像