0
我有以下陣列格式化xmlrpcmsg陣列
Array ([value] => Array ([mf_account] => xxxxx [mf_username] => xxxx [mf_password] => xxxx [as_user_id-int] => e [page-int] => d [page_size-int] => x [get_campaign] => Submit [form_build_id] => form-w1vXG5j2hEeKjKYGomZjuwxWlXqbrGg5tG4ph81J3Xk [form_token] => 9onu89rRyvEWWVtSJpAUw4Ko81sitmo9BpbqtoVD110 [form_id] => messagefocus_settings_all_campaign))
我需要這個數組被格式化,因此,它是適合xmlrpc_client
如果我硬代碼類似如下的數組它工作
$msg = new xmlrpcmsg(
"campaign.all",
array(
new xmlrpcval(
array(
"as_user_id"=> new xmlrpcval('122', "int"),
"page"=> new xmlrpcval('33', "int"),
"page_size"=> new xmlrpcval('23', "int"),
),"struct"
)
)
);
不幸的是我有太多的形式進行硬編碼處理器爲所有這些,所以我真的很想有一個功能,可以通過數組循環,尚未格式化,根據需要解析值。
到目前爲止,我已經嘗試過,但我只是得到錯誤。
//Please ignore all parts of the if statement except the final else
$temp = new xmlrpcmsg();
foreach ($data as $key => $value) {
if($key == 'get_campaign'){
break;
}elseif ($key == 'mf_account' || $key == 'mf_username' || $key == 'mf_password') {
$credentials[$key] = $value;
}else{
//this is where my problems occurs
$keyValues = split('-', $key);
$temp[$keyValues[0]] => new xmlrpcval($value, $keyValues[1]);
}
}
對我來說,這個調試是由雙重尷尬,因爲我有開發它裏面Drupal和形式通過Ajax處理這意味着我得到回來的唯一錯誤是
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/ajax
StatusText: Internal Server Error
ResponseText: