*Controller extends AppCotroller {}
class AppController {
piblic view;
function __constract() {
$this->view = new View();
}
function setView($view) {
// Это на случай если в методе подкласса контроллера нужна вьюха не по имени наследованого котроллера
$this->view = $view;
}
}
* extends ActionModel {
public $valid = [
'pass' => [
'minLen' => 8,
'errMsg' => 'У вас косяк'
];
];
}
return [
'host' => 'localhost',
'db_name' => 'user72751_sovaov',
'username' => 'user72751_sovaov',
'password' => '*******'
];
class DB {
private $config = null;
public function __construct()
{
if(file_exists('/config_bd.php')) {
$this->config = required_once './config_bd.php';
if(is_array($this->config)) {
$conn = new mysqli($this->config['db_name'],
$this->config['username'],
$this->config['password'],
$this->config['host']);
if($conn->connect_error) {
throw new Exception('Нет соедение с БД '.$conn->connect_error);
}
return $conn;
} else {
throw new Exception('Файл конфигураии БД не найден ');
}
}
}
}
2. Можно
В чем трудности?