//Где-то в недрах кода ждем команды...
document.addEventListener("commandFromChat", function(e) {
switch(e.detail.command) {
case "goto": return document.location.href = e.detail.payload;
case "somethingElse": break; //можно обрабатывать разные команды
}
});
//Нам письмо!
let message = {
"type": "command",
"command": "goto",
"payload": "https://flowers.shop/красные-розы-100-см.html"
};
//Получая команду, браузер инициирует событие, например так:
if (message.type === "command") {
let event = new CustomEvent("commandFromChat", { "detail": message});
document.dispatchEvent(event);
}
public function someAction(
\Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository $repo,
\Symfony\Component\HttpFoundation\Request $request
): \Symfony\Component\HttpFoundation\Response
{
$queryBulder = $repo->createQueryBuilder('a');
$em = $queryBulder->getEntityManager();
$MetaData = $em->getClassMetadata($repo->getClassName());
$associations = $MetaData->getAssociationMappings();
}
$pol = mb_convert_encoding($_GET['value'], 'UTF-8', 'windows-1251');
$pol1 = mb_convert_encoding($_GET['oldvalue'], 'UTF-8', 'windows-1251');
$pol = iconv('UTF-8', 'windows-1251', $_GET['value']);
$pol1 = iconv('UTF-8', 'windows-1251', $_GET['oldvalue']);
Почему не находит часть строки с символами подчёркивания?
<?php
if ($pos !== false) { ... }
Как можно обрезать строку и получить brand_id?
<?php
$brand_id = preg_replace('/^_from_search_/', '', $str);
sudo apt install php libapache2-mod-php
sudo systemctl reload apache2
const burger__btn = document.querySelectorAll('.menu__item-link');
//...............
for(let i = 0, l = burger__btn.length; i < l; i++)
burger__btn[i].addEventListener('click', () => {
menu.classList.remove('active');
burger.classList.remove('active-burger');
body.classList.remove('locked');
})
}
const url = 'some url';
try {
const response = await fetch(url);
//.....
} catch {
if (url.startsWith('http:')) {
console.log(`It's may be a mixed content error`);
} else {
try {
await fetch(url, {'mode':'no-cors'}); //если ресурс доступен, то ошибки не будет
console.log(`It's may be a CORS error`);
} catch {
console.log('Other error');
}
}
}
<head>
<!-- ... -->
<style>
.loader {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: url(здесь красивый сплэш);
opacity: 1;
will-change: opacity;
transition: opacity 1s;
}
html, body {
overflow: hidden;
}
</style>
<link type="style/css" rel="style.css" />
</head>
<body>
<div class="loader"></div>
<!-- ... -->
</body>
/*
...
...
...
*/
.loader {
opacity: 0;
}
html, body {
overflow: auto;
}
CMD touch /usr/local/php-logs/php-fpm.log && \
chmod 666 /usr/local/php-logs/php-fpm.log && \
php-fpm -F
Fatal error: Directive 'track_errors' is no longer available in PHP in Unknown on line 0
$('button').on('click', function() {
var id = $(this).find('input').val();
...
select u.name as username,
(select count(id) from orders where user_id=u.id) as orders_count
from users u
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Methods' '*';
add_header 'Access-Control-Expose-Headers' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}