<div id="buttons"></div>
<div id="map"></div>
const items = [
{ coord: [ 55.751244, 37.618423 ], title: 'Moscow' },
{ coord: [ 48.864716, 2.349014 ], title: 'Paris' },
{ coord: [ 34.052235, -118.243683 ], title: 'Los Angeles' },
];
ymaps.ready(function () {
const map = new ymaps.Map('map', {
zoom: 9,
center: items[Math.random() * items.length | 0].coord,
});
items.forEach(n => map.geoObjects.add(new ymaps.Placemark(n.coord)));
const buttons = document.querySelector('#buttons');
buttons.innerHTML = items.map((n, i) =>
`<button data-index="${i}">${n.title}</button>`
).join('');
buttons.addEventListener('click', ({ target: { dataset: { index } } }) => {
if (index) {
map.setCenter(items[index].coord);
}
});
});
TrimStrings
и ConvertEmptyStringsToNull
, которые модифицируют данные запроса, нормализуя их. Следовательно, по аналогии можно создать милдварю, которая нормализует конкретно телефон и подключить к тем роутам, к которым нужно. <input
type="password"
name="password"
readonly
onfocus="this.removeAttribute('readonly')">
http_build_query()
$params = array(
'foo' => 'bar'
);
...
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params));
...
date("m", strtotime("+1 month"));
Relative month values are calculated based on the length of months that they pass through. An example would be "+2 month 2011-11-30", which would produce "2012-01-30". This is due to November being 30 days in length, and December being 31 days in length, producing a total of 61 days.
$next_month = date("m")+1 > 12 ? 1 : date("m")+1;
$post_next_month = $next_month+1 > 12 ? 1 : $next_month+1;
$date = new \DateTime('now');
echo $date->modify('+1 month')->format('M');