<?php
$xml = new SimpleXmlElement(<<<XML
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE yml_catalog SYSTEM "shops.dtd">
<yml_catalog>
</yml_catalog>
XML
);
$xml->addAttribute('date', (new DateTimeImmutable())->format('Y-m-d H:i'));
print $xml->asXML();
// <?xml version="1.0" encoding="utf-8"?>
// <!DOCTYPE yml_catalog SYSTEM "shops.dtd">
// <yml_catalog date="2024-01-24 16:42">
// </yml_catalog>
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid. This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
# See also: httpd.apache.org/docs/misc/FAQ.html#forbidden
#
// Получаем массив $res
// Формируем массив дат
$list = [];
$minDate = strtotime('-7 days');
$maxDate = strtotime(date());
for($date = $minDate; $date <= $maxDate; $date += 24*60*60) {
$list[date('Y-m-d', $date)] = 0;
}
// Заполняем данными
foreach ($res as $row) {
$list[date('d.m.Y', strtotime($row['stat_day']))] = $row['count'];
}
$list_date[] = array_keys($list);
$list_count[] = array_values($list);
- $context = stream_context_create($query);
+ $context = stream_context_create($query_options);
select n.*, -- атрибуты новости
p1.*, -- атрибуты автора
p2.*, -- атрибуты исполнителя
s.* -- атрибуты статуса новости
from news n
join status s on s.statusId = n.statusId
left join people p1 on p1.peopleId = n.authorId
left join people p2 on p2.peopleId = n.executorId
where p1.fullName like :search
or p2.fullName like :search
select *
from news
select n.*, -- атрибуты новости
s.* -- атрибуты статуса новости
from news n
join status s on s.statusId = n.statusId
select n.*, -- атрибуты новости
s.* -- атрибуты статуса новости
from news n
join status s on s.statusId = n.statusId
where s.statusId = :statusId
select n.*, -- атрибуты новости
p1.*, -- атрибуты автора
p2.*, -- атрибуты исполнителя
s.* -- атрибуты статуса новости
from news n
join status s on s.statusId = n.statusId
left join people p1 on p1.peopleId = n.authorId
where p1.fullName like :search
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
/blog/post-url
$uri = trim($_SERVER['REQUEST_URI'], '/'); // обрезать концевые слеши
$segments = explode('/', $uri); // Разбить в массив по слешам
// и простейший роутинг
switch ($segments[0]??null) {
case 'blog':
$slug = $segments[1];
include 'blog.php';
break;
default:
echo 'Homepage';
}
$post = query('SELECT * FROM posts WHERE slug = :slug', ['slug' => $slug]);
if (!$post) {
echo '404';
die;
}
echo $post->title;
echo $post->content;
Я нажимаю добавить картинку, она уходит на сервер, там ей присваивается новое уникальное имя,