I am trying to write some JSON data in a view file in CodeIgniter.
But it shows an error:
Message: fopen() [function.fopen]: Filename cannot be empty
The controller function is as follows:
public function write_in_a_view_file() {
$data = array();
$data['title'] = "Write This Title In a View File";
$view_file = $this->load->view('result.php');
$fp = fopen($view_file, 'w');
fwrite($fp, json_encode($data));
fclose($fp);
}