PHP操作ini配置文件
//用法
//
$sampleData = array(
'first' => array(
'first-1' => 1,
'first-2' => 2,
'first-3' => 3,
'first-4' => 4,
'first-5' => 5,
),
'second' => array(
'second-1' => 1,
'second-2' => 2,
'second-3' => 3,
'second-4' => 4,
'second-5' => 5,
));
write_ini_file($sampleData, './data.ini', true);
//读ini文件
public function readini($name)
{
if (file_exists(SEM_PATH.'init/'.$name))
{
$data = parse_ini_file(SEM_PATH.'init/'.$name,true);
if ($data)
{
return $data;
}
}
else
{
return false;
}
}