$elem2)">
时间:2021-07-01 10:21:17 帮助过:46人阅读
//用法
//
$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;
}
}
如果在python中处理,需要将PHP生成的配置文件值两边的双引号去掉。也就是把上面生成ini配置文件函数的\"去掉即OK。