$elem2)">
时间:2021-07-01 10:21:17 帮助过:7人阅读
//用法
//
$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。
http://www.bkjia.com/PHPjc/326785.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/326785.htmlTechArticlePHP操作ini配置文件 代码如下:?php //写ini文件 function write_ini_file($assoc_arr, $path, $has_sections=FALSE) { $content = ""; if ($has_sections) { foreac...