我在日志檔案中遇到錯誤這
ERROR - 2022-05-13 02:47:21 --> Severity: error --> Exception: Too few arguments to function Transactions_model::get_pending_dash(), 0 passed in /Applications/MAMP/htdocs/application/controllers/admin/Dashboard.php on line 47 and exactly 1 expected /Applications/MAMP/htdocs/application/models/Transactions_model.php 2134
這是第 47 行上dashboard.php 的控制器下的確切代碼:
$transactions = $this->transactions_model->get_pending_dash();
這是 transactions_model.php 模型下的確切代碼:
// total transactions ////////////////////////////////////////////
function total_dash_transactions()
{
$s= $this->db->select("COUNT(*) as num")->get("transactions");
$r = $s->row();
if(isset($r->num)) return $r->num;
return 0;
return $result[0]->Transactions;
}
function get_pending_dash($user)
{
$where = "status = '1' AND type = '2'";
return $this->db->where($where)->order_by('id', 'DESC')->limit(20)->get("transactions");
}
uj5u.com熱心網友回復:
因為在您的函式中 get_pending_dash 需要$user作為引數,但根據您的代碼,您也沒有使用它,所以如果您不使用該引數,只需洗掉$user下面的代碼。
function get_pending_dash()
{
$where = "status = '1' AND type = '2'";
return $this->db->where($where)->order_by('id', 'DESC')->limit(20)->get("transactions");
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/473024.html
