Hi I want to write a ini file into php. first i upload a ini file to my server then i edit it, i want to make some changes in parameters then want save that file back to uploads.
I used put_file_contents
and fwrite
but didn't get required result.
this is my code:
$data = array('upload_data' => $this->upload->data());
foreach ($data as $info)
{
$filepath = $info['file_path'];
$filename= $info['file_name'];
}
$this->data['parameters'] = parse_ini_file($filepath.$filename);
$insert = array(
'OTAID' => $this->input->post('OTAID'),
'SipUserName' => $this->input->post('SipUserName') ,
'SipAuthName' => $this->input->post('SipAuthName'),
'DisplayName' => $this->input->post('DisplayName'),
'Password' => $this->input->post('Password'),
'Domain' => $this->input->post('Domain'),
'Proxy' => $this->input->post('Proxy'),
'ServerMode' => $this->input->post('ServerMode')
);
$this->load->helper('file');
$file =fopen($filepath.$filename,'w');
fwrite($file,implode('', $insert));
$this->data['subview'] = 'customer/upload/upload_success';
$this->load->view('customer/_layout_main', $this->data);