The Model-View-Controller (MVC) design pattern is commonly used in web development to organize code and separate logic.
In a simple MVC structure:
<?php
// Controller (controller.php)
require_once 'model.php';
$model = new Model();
$data = $model->getData();
include 'view.php'; // View
// Model (model.php)
class Model {
public function getData() {
return "Hello from the model!";
}
}
// View (view.php)
echo $data;
?>
Create a simple user login page following the MVC pattern with separate files for model, view, and controller.
Answers: MVC stands for Model-View-Controller. The controller handles user input and manages the communication between the model and view.