2011-11-15 30 views
2

我正在嘗試使用WHMCS API的「添加客戶端」插入一些額外的客戶端詳細信息。 但是插入發生,但customfields變得沒有效果,當我在WHMCS客戶area.I檢查已customfield[1],[2]...[5]添加爲客戶area.The代碼字段片斷如下未使用WHMCS API插入的自定義字段

$postfields["action"] = "addclient"; 

$customfields = array(
'customfield[1]' => "ABC", 
'customfield[2]' => "XYZ" 
); 

$postfields["customfields"] = base64_encode(serialize($customfields) 

請提出一個解決方案。

回答

6

我已經解決了這個問題。

我只是改變

$customfields = array(
'customfield[1]' => "ABC", 
'customfield[2]' => "XYZ" 
); 

$postfields["customfields"] = base64_encode(serialize($customfields) 

$postfields["customfield[1]"] = "ABC"; 
$postfields["customfield[2]"] = "XYZ"; 
+0

剛一說明,有些人可能會發現有用的。無論我嘗試過什麼,我都無法在創建新客戶端時通過API插入自定義字段,但在創建客戶端時確實有效,然後使用'updateclient'api命令直接更新客戶端的自定義字段。 – azzy81

1

下要解決這個問題:

$customfields = array('1' => "ABC", '2' => "XYZ"); 
$postfields["customfields"] = base64_encode(serialize($customfields) 
相關問題