Creating a content-length header

A simple way of creating a content-length header using output buffering:
<?php
// php code.
ob_start();
?>

<!-- HTML tag and the rest of content. -->

<?php
header('Content-Length: '. ob_get_length());
ob_end_flush();
?>


This document was last updated July 2nd, 2011.
Written by: Dag Jonny Nedrelid
©2007-2012 http://thronic.com


Feel free to leave a comment.
Name:
URL:
0