$endpoint = 'https://clivir.ru/wp-json/wp/v2/posts';
$data = json_decode(file_get_contents($endpoint), true);
foreach ($data as $datum) {
$title = $datum['title']['rendered'];
$content = $datum['content']['rendered'];
// ...
}
<?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
)
*/
function position($val1, $val2, $val3) {
// ...
return $result ?? position($val1, $val2, $val3);
}
class PageController extends Controller
{
public function news()
{
$news = News::where('active', 1)->first();
return view('news', ['news' => $news]);
}
public function contacts()
{
$social = [/* ... */];
return view('contacts', ['social' => $social]);
}
}
$md5_hash = md5_file($_FILES["fail"]["tmp_name"], true);
$stmt = $pdo->prepare('SELECT * FROM download__files WHERE md5hash = :md5hash');
$stmt->execute(['md5hash' => $md5hash]);
$result = $stmt->fetchColumn();