gpt4 book ai didi

PHP警告: Missing argument 1

转载 作者:行者123 更新时间:2023-11-29 13:29:36 25 4
gpt4 key购买 nike

我是 php 新手,我正在尝试在 php 5 中工作,所以我调用了一个参数化函数,但它给了我异常“警告:缺少参数 1”,这是我的类

class EditUser extends DBConn
{

private $id;
function editUser($id)
{
$this->id = $id;
echo $id;
die;

$rows =array();
self::Set_DBConni();
$mysqli = self::get_Conn();
$result = $mysqli->query("SELECT * FROM users where id ='".$id."' ");

while($row = $result->fetch_row())
{
$rows[] = $row;

}


return $rows;

/* free result set */
$result->close();

/* close connection */
$mysqli->close();

}


}

这就是我所说的

include_once('include/classes/edituser.php'); 

$objPage = new EditUser();

$objPage->editUser($_GET['id']);

但它向我显示了警告,那就是

Warning: Missing argument 1 for EditUser::editUser(), called in E:\xampp\htdocs\WaleedWork\claremont\admin\edit_user.php on line 45 and defined in E:\xampp\htdocs\WaleedWork\claremont\admin\include\classes\edituser.php on line 8

Notice: Undefined variable: id in E:\xampp\htdocs\WaleedWork\claremont\admin\include\classes\edituser.php on line 10

Notice: Undefined variable: id in E:\xampp\htdocs\WaleedWork\claremont\admin\include\classes\edituser.php on line 11

请告诉我出了什么问题,因为我认为我使用了正确的方式来调用它。

最佳答案

你的editUser方法是一个构造函数,你可以这样做

$objPage = new EditUser($_GET['id']);

关于PHP警告: Missing argument 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19654641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com