我正在尝试将我的 p4a 应用程序的用户重定向到我的应用程序的仪表板视图,但在成功登录后,重定向到“main_dashboard_mask”出现错误“找不到方法 openmask login_mask.php 第 35 行”
class login_mask extends P4A_Base_Mask
{
public function __construct()
{
parent::__construct();
$this->setTitle("Login to Dashboard");
$this->build("p4a_field", "username");
$this->build("p4a_field", "password");
$this->build("p4a_button", "login")
->implement("onclick", $this, "login");
$this->frame
->anchor($this->username)
->anchor($this->password)
->anchor($this->login);
}
public function login()
{
$username = $this->username->getNewValue();
$password = $this->password->getNewValue();
$sql = "SELECT * FROM users
WHERE
username = ?";
$row = p4a_db::singleton()->fetchRow($sql, array($username));
if (($row['username'] == $username) && ($row['password'] == $password )){
$this->openMask("main_dashboard_mask");}
else {
$this->setTitle("Login Failed");}
}
}
我不确定它是索引文件还是我在这里错过的东西,好的,现在我又经历了一次,无论我将功能放在页面上的哪个位置,我似乎都找不到问题,无论错误在哪里继续发生,这让我认为问题来自较早的页面之一,它们是:
<?php
define ("P4A_DSN", "mysql://root:@localhost/login" );
require_once dirname(__FILE__) . '/../../p4a.php';
$login = p4a::singleton('login_begin');
$login->main();
...
<?php
class login_begin extends P4A
{
public function __construct()
{
parent:: __construct();
$this->openMask("login_mask");
}
}
任何帮助都会非常感激。