Следите за новинками
в нашем Telegram канале. Жми, чтобы подписаться:)
⊗ppPmHpSC 403 of 447 menu
◀ ▶

Returning HTTP Response Status in PHP

You can set the HTTP response status separately, without specifying the start line. This is done using the function http_response_code:

<?php http_response_code(404); ?>

Complete the code so that it returns the corresponding HTTP statuses:

<?php $arr = ['a', 'b', 'c']; if (isset($_GET['key'])) { $key = $_GET['key']; if (isset($arr[$key])) { echo $arr[$key]; } else { // return 404 echo 'Not Found'; } } else { // return 403 echo 'Forbidden'; } ?>
← →
↑
English▼
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline