media Array of InputMediaAudio, InputMediaDocument, InputMediaPhoto and InputMediaVideo
* Request::sendMediaGroup([
* 'media' => [
* new InputMediaPhoto(['media' => Request::encodeFile($local_photo_1)]),
* new InputMediaPhoto(['media' => Request::encodeFile($local_photo_2)]),
* new InputMediaVideo(['media' => Request::encodeFile($local_video_1)]),
* ],
* ]);
* and even
* Request::sendMediaGroup([
* 'media' => [
* new InputMediaPhoto(['media' => $local_photo_1]),
* new InputMediaPhoto(['media' => $local_photo_2]),
* new InputMediaVideo(['media' => $local_video_1]),
* ],
* ]);
<?php
$html = '<select name="appointments[consulate_appointment][facility_id]" id="appointments_consulate_appointment_facility_id" class="required"><option value="" label=" "></option>
<option data-collects-biometrics="false" value="89">Calgary</option>
<option data-collects-biometrics="false" value="90">Halifax</option>
<option data-collects-biometrics="false" value="91">Montreal</option>
<option data-collects-biometrics="false" value="92">Ottawa</option>
<option data-collects-biometrics="false" value="93">Quebec City</option>
<option data-collects-biometrics="false" value="94">Toronto</option>
<option data-collects-biometrics="false" selected="selected" value="95">Vancouver</option></select>';
$dom = new DOMDocument();
$dom->loadHTML($html);
$xpath = new DOMXpath($dom);
$result = $xpath->query("//select/option[@selected='selected']");
$value = $result->item(0)->getAttribute('value');
var_dump($value); //string(2) "95"
</head>
вы как минимум уже получаете невалидный html$html
есть </style>
внутрь которого вы и хотите свои стили дописатьforeach ($this->_styles as $tag => $style) {
$styles = $tag . '{' .$style. '}'."\n";
$html = str_replace('</style>', $styles.'</style>', $html);
}
<?php
$streams = [
'{"stream":"xrpusdt@bookTicker","data":{"u":10936805954,"s":"XRPUSDT","b":"0.64420000","B":"3076.00000000","a":"0.64440000","A":"6180.00000000"}}',
'{"stream":"xrpusdt@bookTicker","data":{"u":10936805954,"s":"BNBUSDT","b":"0.64420000","B":"3076.00000000","a":"0.64440000","A":"6180.00000000"}}'
];
$result = [];
foreach($streams as $json_str) {
$data = json_decode($json_str, true); //сама строка json в которой ищем
//var_dump($data['data']);
if(in_array($data['data']['s'], [
'XRPUSDT',
'BNBUSDT',
])) {
$result[$data['data']['s']] = $data['data']['b'];
}
}
print_r($result);
Array
(
[XRPUSDT] => 0.64420000
[BNBUSDT] => 0.64420000
)
Warning
This function was deprecated in PHP 4.3.0
<?php
if (isset($_POST['savenewcfg'])) {
$template = '<?php
class config {
{{CONTENT}}
}';
$content = '';
foreach ($_REQUEST as $key => $value) {
if($key === 'savenewcfg') {
continue;
}
$content .= 'public $'.$key.' = \''.str_replace("'", "\'", $value).'\'; '."\n";
}
file_put_contents(
$configFile,
str_replace('{{CONTENT}}', $content, $template)
);
}
<?php
$str = 'https://testy-dlya-medsester.ru/nmo/2892-nastavnichestvo-kak-metod-adaptatsii-molodykh-spetsialistov-v-sestrinskoj-deelnosti/Question-2892-3ecd193a222eb56c35ec4cb7895ee08a';
$result = explode('/Question-', $str, 2)[0] ?? '';
var_dump($result);
$schedule->job(new SyncChangesFrom1C)
->everyMinute()
->withoutOverlapping()
->runInBackground();
while(true) {
//делаем работу
sleep(10);
}
return 0;
withoutOverlapping()
по умолчанию ставит лок на 24 часа (на 1440 минут) и если скрипт крутится больше этого времени то будет запущен второй экземпляр.