如何在同一PHP方程中更改参数的值

时间:2019-03-11 15:12:31

标签: php parameters

我正在尝试为每个“ column_id”参数更改“ text”参数的值。例如:

'column_id' => 'email'
'text' => 'foresthill@mailto.com

'column_id => 'phone'
'text' => '555-555-5555'

如果我有一个column_id和text参数,则该方程式有效,但是当我尝试将第二个column_id'phone'的值更改为文本值555-555-5555时,电话号码显示在'email'列中

如何使文本值进入其自己的column_id,如下所示:

email = example@example.com
phone = 555-555-5555.

代码:

//********************** Update Pulse Columns for a specific pulse ***********************      
$put_fields = array(
     //monday.com board and user id values
     'board_id' => '194618490',
     'column_id' => 'email1',
     'pulse_id' => 197299328,
     'text' => 'foresthill@mailto.com'
);    
$put_fields = array(
     //monday.com board and user id values
     'board_id' => '194618490',
     'column_id' => 'phone',
     'pulse_id' => 197299328,
     'text' => '555-555-5555'
);
$ch =  curl_init('https://api.monday.com:443/194618490/columns/email1/text.json?api_key=api_key');
//curl_setopt($ch, CURLOPT_USERAGENT, 'ARPR');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
//curl_setopt($ch, CURLOPT_URL, URL. $api);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $put_fields);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
//$curl_result = curl_exec($ch);
//curl_close($ch);
print "<pre>";
print_r($curl_result);
print "</pre>";

0 个答案:

没有答案