-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
executable file
·42 lines (34 loc) · 1.25 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
error_reporting (E_ALL);
require 'libs/Bootstrap.php';
require 'libs/Controller.php';
require 'libs/Model.php';
require 'libs/View.php';
require 'libs/Database.php';
require 'libs/Session.php';
require 'config/paths.php';
require 'config/database.php';
$app = new Bootstrap();
// + Создаем класс
class ShopProduct {
// Объявляем переменные
public $title = "Стандартный товар";
public $producerMainName = "Фамилия автора";
public $producerFirstName = "Имя автора";
public $price = 0;
//Создание объекта Модели
function __construct ($title, $firstName, $mainName, $price) {
$this->title = $title;
$this->producerFirstName = $firstName;
$this->producerMainName = $mainName;
$this->price = $price;
}
// Метод функции
function getProducer() {
return "{$this->producerFirstName}".
" {$this->producerMainName}";
}
}
// Вызов функции
$product1 = new ShopProduct ("Собачье сердце", "Михаил", "Булгаков", 5.99);
print "Автор: ".$product1->getProducer()."\n";