php - header("HTTP/1.1 200 $status_message") took more than 5 second to run on local host. AM I doing something wrong? -
My code is given below, its a simple rest API, when the URL is called from any other page, the header (" HTTP / 1.1 "), it takes 5 seconds to return the response. I'm running it on a local host. itemprop = "text">
& lt ;? Php header ("Content_type: application / json"); If (! $ _ GET ['name'])) {$ name = $ _ GET ['name']; $ Value = get_price ($ name); If (! Blank ($ value)) {response ('200', 'book found', $ value); } And {feedback ('200', 'Book Not Found', blank); }} And {feedback ('400', 'Invalid Request', Faucet); } Function response ($ position, $ position_conference, $ data) {header ("HTTP / 1.1 $ status, $ status_message"); // take this line more than 5 seconds to run the $ [$ status] = $ position; $ ['Status_message'] = $ status_message result; $ ['Data'] = $ data result; Echo json_encode ($ result); } Get_price function ($ name) {$ book = ['a' = & gt; 100, 'b' = & gt; 200, 'c' = & gt; 300]; Forex currency ($ book as $ key = & gt; $ value) {if ($ key == $ name) {return $ value; break; }}}? & Gt;
Comments
Post a Comment