2016-01-07 104 views
1

剛剛得到開始配置/精簡版(https://github.com/pear/Config_LiteCONFIG /精簡版和陣列

但似乎它不象數組變量,比如我有以下我的INI文件:

[Meta Tags] 
    meta[site_description] = "" 
    meta[site_keyword] = "" 
    meta[site_title] = "FooBar" 
    meta[site_type] = "Website" 
    meta[site_url] = "site.com" 
    meta[site_image] = "" 

而且如果我運行以下命令:

$lite = new Config_Lite("myfile", LOCK_EX); 
$lite->set("MetaTags", "meta[site_keyword]", "keyword"); 
$lite->save(); 

我結束了我的INI文件如下:

[Meta Tags] 
    meta[site_description] = "" 
    meta[site_keyword] = "" 
    meta[site_title] = "FooBar" 
    meta[site_type] = "Website" 
    meta[site_url] = "site.com" 
    meta[site_image] = "" 
    meta[site_keyword] = "keyword" 

它似乎沒有認識到已經有一個名爲meta [site_keyword]的值,並且只創建一個新條目。難道我做錯了什麼?

回答

2

我不知道,如果你做錯了什麼如此... 這是我用Config_Lite更新一個具體線路:

<?php 
require_once 'Config/Lite.php'; 
$lite = new Config_Lite("myfile", LOCK_EX); 
$meta = ($lite->get('Meta Tags', 'meta')); 
$meta['site_keyword'] = "keyword"; 
$lite->setSection("Meta Tags", ['meta' => $meta]); 
$lite->save(); 
+0

哼!也許我的語法錯了,我會放棄它,謝謝! – Chud37