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

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -