如何访问列对象中的状态或道具。因为我需要通过filterDropdown中的状态加载数据。
这是代码
<?php
require('./vendor/autoload.php');
use \DrewM\MailChimp\MailChimp;
$apiKey = '{API_KEY}';
$listID = '{LIST_ID}';
$campaignId = '{campaignId}';
$MailChimp = new MailChimp($apiKey);
# 1.Get template sections by giving template id
$templateId = '{templateId}';
$subResourse = "default-content";
$result = $MailChimp->get("templates/$templateId/$subResourse");
$response = $MailChimp->getLastResponse();
if($response['headers']['http_code'] == 200){
$responseObj = json_decode($response['body']);
if(isset($responseObj->sections)){
# 2. Edit the data which are editable
$sectionsEditable = $responseObj->sections;
foreach($sectionsEditable as $key=>$val){
$editabelArrayData[$key] = utf8_encode(100);
}
if(isset($editabelArrayData)){
$dataToSendForEditContent = array(
"template" => array(
"id" => $templateId,
"sections" => $editabelArrayData
)
);
$result = $MailChimp->put("campaigns/$campaignId/content", $dataToSendForEditContent);
$editedResponse = $MailChimp->getLastResponse();
if($editedResponse['headers']['http_code'] == 200){
# 3 . Send Mail
$emailDataToSend = array(
"test_emails" => array(
"{email_address}"
),
"send_type" => "html"
);
$sendResponse = $MailChimp->post("campaigns/$campaignId/actions/test", $emailDataToSend);
if($sendResponse){
print('Test Mail Sent Successfully!');
$sendResponseProd = $MailChimp->post("campaigns/$campaignId/actions/send");
if($sendResponse){
echo"</br>";var_dump($sendResponse);exit;
}
}else{
exit('Send Errors!');
}
}else{
$editedResponseObj = json_decode($editedResponse['body']);
echo"<pre>";print_r($editedResponseObj);
exit('Edit Error');
}
}else{
# Test Mail
$emailDataToSend = array(
"test_emails" => array(
"{email_address}"
),
"send_type" => "html"
);
$sendResponse = $MailChimp->post("campaigns/$campaignId/actions/test", $emailDataToSend);
if($sendResponse){
print('Test Mail Sent Successfully!');
echo"</br>";
#make Production Testing
$sendResponseProd = $MailChimp->post("campaigns/$campaignId/actions/send");
echo"<pre>";print_r($sendResponseProd);exit;
}else{
exit('Send Errors!');
}
}
}
}else{
exit('Error!');
}
我收到的“项目”未定义错误。