亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為啥什么都沒顯示……也沒報錯……說好的hello world呢!

<?php

	class?testController{
		function?show(){?//控制器的作用時調用模型,并調用視圖,將模型產生的數據傳遞給視圖,并讓相關視圖去顯示
			$testModel?=?new?testModel();
			$data?=?$testModel->get();
			$testView?=?new?testView();
			$testView->$display($data);
		}
	}


?>
<?php

	class?testModel{
		function?get(){?//模型的作用時獲取數據并處理返回數據
			return?"Hello?World!";
		}
	}

?>

testView.class.php

<?php

	class?testView{
		function?display($data){?//視圖的作用時將取得的數據進行組織,美化等,并最終向用戶終端輸出
			echo?$data;
		}
	}

?>
<?php

//如果有錯,include()報一個警告
//如果有錯,require_once()報一個嚴重錯誤

require_once('testController.class.php');
require_once('testModel.class.php');
require_once('testView.class.php');

$testController?=?new?testController();
$testController->show();

?>


正在回答

1 回答

testController里的這個地方 $testView->$display($data); 寫錯了,應該是$testView->display($data);

0 回復 有任何疑惑可以回復我~
#1

全民工作狂 提問者

果然!謝謝老師!
2015-09-30 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為啥什么都沒顯示……也沒報錯……說好的hello world呢!

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號