phpcodeignitercontent-length

Content length for code igniter view


Is it possible to get the length of the data that will be sent to browser when a view file is loaded?

For example,

$this->load->view("article", array("data" => $data));

I would like to know the content length that should be sent to browser. Since the data sent can also be an array, it might increase the length of the HTML content.

It is unlikely that code igniter has anything built in for this. I'm open for ideas.


Solution

  • do you mean like:

    $data_content = $this->load->view("article", array("data" => $data), TRUE);
    ob_start();
    echo $data_content;
    $length = ob_get_length();
    ob_end_clean();
    echo $length;