本文介紹了使用 PHP 的簡單 MVP 示例的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我知道如何使用 MVC 模型,但我不知道如何使用 MVP.我閱讀了它們之間的差異,但不知道如何實現.
I know how to work with the MVC model, but I don't have an idea how to work with MVP. I read about the differences between them but don't know how to accomplish it.
推薦答案
區別是雙重的:
- 視圖是被動的,不知道模型
- presenter(控制器)改變模型狀態,讀取信息并將其傳遞給視圖
public function showUsers()
{
// -- snip
$data = $accountManager->getUserDetails($from = 10, $to = 20);
$view->bind('list', $data);
// -- snip
}
這將是演示者方法的一個簡化示例.這里是一個舊答案,簡要解釋了 php 中使用的類 MVC 模式之間的差異.
This would be a simplified example of presenter's method. Here is an old answer, briefly explaining the differences between MVC-like patterns used in php.
這篇關于使用 PHP 的簡單 MVP 示例的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!