$DB->close();
Открытые непостоянные соединения MySQL и результирующие наборы автоматически удаляются сразу по окончании работы PHP скрипта. Следовательно, закрывать соединения и очищать результирующие наборы не обязательно, но рекомендуется, так как это сразу же освободит ресурсы базы данных и память, занимаемую результатами выборки, что может положительно сказаться на производительности. Больше информации можно почерпнуть в разделе Освобождение ресурсов
<?php
$content='"{\"orderId\":\"ORDER-294\",\"paymentState\":\"CANCELED\",\"signature\":\"naK+I79FduGkXFHpVT\/aJT31EfQ=\",\"message\":\"\u041a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b \u043e\u043f\u043b\u0430\u0442\u0443\",\"storeId\":\"158CC6EE85DA472AB3FB\"}"';
$res=json_decode(json_decode($content), true);
print_r($res);
/*Array
(
[orderId] => ORDER-294
[paymentState] => CANCELED
[signature] => naK+I79FduGkXFHpVT/aJT31EfQ=
[message] => Клиент не завершил оплату
[storeId] => 158CC6EE85DA472AB3FB
)
*/
document.addEventListener('click', evt => {
if (evt.target.matches('button.action, button.action *')) {
console.log('target', evt.target)
let button = evt.target.closest('button')
console.log('button', button)
}
})
// When the window has finished loading create our google map below
google.maps.event.addDomListener(window, 'load', init);
function init() {
// Basic options for a simple Google Map
// For more options see: https://developers.google.com/maps/documentation/javascript/reference#MapOptions
var mapOptions = {
// How zoomed in you want the map to start at (always required)
zoom: 11,
// The latitude and longitude to center the map (always required)
center: new google.maps.LatLng(40.6700, -73.9400), // New York
// How you would like to style the map.
// This is where you would paste any style found on Snazzy Maps.
styles: [{"elementType":"labels","stylers":[{"visibility":"off"},{"color":"#f49f53"}]},{"featureType":"landscape","stylers":[{"color":"#f9ddc5"},{"lightness":-7}]},{"featureType":"road","stylers":[{"color":"#813033"},{"lightness":43}]},{"featureType":"poi.business","stylers":[{"color":"#645c20"},{"lightness":38}]},{"featureType":"water","stylers":[{"color":"#1994bf"},{"saturation":-69},{"gamma":0.99},{"lightness":43}]},{"featureType":"road.local","elementType":"geometry.fill","stylers":[{"color":"#f19f53"},{"weight":1.3},{"visibility":"on"},{"lightness":16}]},{"featureType":"poi.business"},{"featureType":"poi.park","stylers":[{"color":"#645c20"},{"lightness":39}]},{"featureType":"poi.school","stylers":[{"color":"#a95521"},{"lightness":35}]},{},{"featureType":"poi.medical","elementType":"geometry.fill","stylers":[{"color":"#813033"},{"lightness":38},{"visibility":"off"}]},{},{},{},{},{},{},{},{},{},{},{},{"elementType":"labels"},{"featureType":"poi.sports_complex","stylers":[{"color":"#9e5916"},{"lightness":32}]},{},{"featureType":"poi.government","stylers":[{"color":"#9e5916"},{"lightness":46}]},{"featureType":"transit.station","stylers":[{"visibility":"off"}]},{"featureType":"transit.line","stylers":[{"color":"#813033"},{"lightness":22}]},{"featureType":"transit","stylers":[{"lightness":38}]},{"featureType":"road.local","elementType":"geometry.stroke","stylers":[{"color":"#f19f53"},{"lightness":-10}]},{},{},{}]
};
// Get the HTML DOM element that will contain your map
// We are using a div with id="map" seen below in the <body>
var mapElement = document.getElementById('map');
// Create the Google Map using our element and options defined above
var map = new google.maps.Map(mapElement, mapOptions);
// Let's also add a marker while we're at it
var marker = new google.maps.Marker({
position: new google.maps.LatLng(40.6700, -73.9400),
map: map,
title: 'Snazzy!'
});
}
styles:
$.post('/local/upload_parser.php?parse=' + parse_schedule, function(data){ *** });
$.ajax({
type:'POST',
url: '/local/upload_parser.php',
'data': {
parse: JSON.stringify(parse_schedule.slice(0,5))
},
success: function(data){
var result = JSON.parse(data);
alert("Все гуд!");
},
error: function(){
alert("Ахтунг, проблема!");
}
});
const digits = Object
.entries([...`${num}`].reduce((acc, n) => (acc[n] = (acc[n] || 0) + 1, acc), {}))
.reduce((acc, n) => (n[1] > 1 && acc.push(+n[0]), acc), []);
const digits = num
.toString()
.split('')
.reduce((acc, n) => (acc[n]++, acc), Array(10).fill(0))
.map((n, i) => n > 1 && i)
.filter(n => n !== false);
const digits = Array
.from(String(num), Number)
.filter((n, i, a) => i !== a.indexOf(n))
.filter((n, i, a) => i === a.indexOf(n));
const digits = (('' + num)
.match(/\d/g)
.sort()
.join('')
.match(/(\d)\1+/g) || [])
.map(n => n[0] | 0);
image = new Array();
image[0]=array(
'path' => 'адрес до картинки',
'class' => 'green',
)
<link rel="stylesheet" href="style.css?v=<?= time()?>">
preg_replace('/(@[a-zA-Zа-яА-Я0-9]+?)#(\d+)/u', '<a href="/user/$2" class="user-tag">$1</a>', $text);
.poverflow {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
<p class="poverflow">Есть ли готовый плагин, который позволяет скрыть многострочный текст(с добавлением троеточия в конце) и кнопкой развернуть текст/скрыть. С условием, что раскрытие текста происходит плавно( не создавая скрытый див с контентом )?</p>
<a href="#" onclick="showorhide(this.previousElementSibling)">показать/скрыть</a>
function showorhide (el) {
if (el.classList.contains("poverflow")) {
el.classList.remove("poverflow");
} else {
el.classList.add("poverflow");
}
}