How to ensure that my response from server has `Content-Length` header with PHP? -
this how response server:
include('../connection.php'); connection(); mysql_query('set names utf8'); $response = array(); $words = array(); $query = "select * `$table` order `created_at` desc"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { $row['id'] = intval($row['id']); array_push($words, $row); } $response['words'] = $words; echo json_encode($response);
but need here content-length
header. how can check or add/create such header?
php handles if enable output buffeting. when write output stream (via buffer) php knows how you've written , sets header value before sending response body.
Comments
Post a Comment