第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

medoo類(lèi)庫(kù)使用其方法后導(dǎo)致類(lèi)中使用構(gòu)造函數(shù)后報(bào)錯(cuò)

部分代碼:

\app\model\cModel.php下:

class cModel extends model

{

? public $table;

? public function __construct($table1)

? {

? ? $this->table = $table1;

? }

? public function lists()

? {

? ? $ret = $this->select($this->table,'*');

? ? return $ret;

? }


\app\ctrl\indexCtrl.php下:

<?php

namespace app\ctrl;

use core\lib\model;

class indexCtrl extends \core\future

{

? public function index(){

? ? $table1 = 'users';

? ? $model = new \app\model\cModel($table1);

? ? $ret = $model->delOne(1);

? ? dump($ret);

? ? $ret1 = $model->lists();

? ? dump($ret1);

? }

}

值可以傳過(guò)去,但是報(bào)medoo的錯(cuò)誤,Undefined property: app\model\cModel::$pdo


正在回答

1 回答

解決了,,因?yàn)樽宇?lèi)的構(gòu)造函數(shù)? ?會(huì)覆蓋父類(lèi)的構(gòu)造函數(shù),,于是在子類(lèi)中聲明構(gòu)造函數(shù)的時(shí)候,需要在子類(lèi)中繼承父類(lèi)的構(gòu)造函數(shù),以使父類(lèi)的構(gòu)造函數(shù)依然生效。代碼:

public function __construct($table1)

? {

? ? $this->table = $table1;

????parent::__construct();? ? ? //禍根就出在這里!?。?br />

? }


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

medoo類(lèi)庫(kù)使用其方法后導(dǎo)致類(lèi)中使用構(gòu)造函數(shù)后報(bào)錯(cuò)

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)