php – Refresh page at time interval

Question:

I need to set the goal:

meta http-equiv="refresh" content="30"

However I'm using CodeIgniter and I can't do it. I tried:

$this->output->set_header('refresh:30;url=minhapagina.php');

Any suggestion?

Answer:

Put it directly in your View, you can even configure whether you'll need it or not! So

public function index(){
        $data['stsRefresh'] = true;
        $this->load->view('Arquivos/index', $data);
}

And in your View

<html>
<head>
<title>Upload Form</title>
</head>
<body>
<?php
    if (isset($stsRefresh)){
        echo '<meta http-equiv="refresh" content="300">';
    }
?>
<form action="/arquivos/do_upload" method="post" enctype="multipart/form-data">
<input type="file" name="userfile" size="20" />

<br /><br />

<input type="submit" value="upload" />

</form>

</body>
</html>

Referência

Scroll to Top