本文整理汇总了PHP中Convert::Array2JSON方法的典型用法代码示例。如果您正苦于以下问题:PHP Convert::Array2JSON方法的具体用法?PHP Convert::Array2JSON怎么用?PHP Convert::Array2JSON使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Convert
的用法示例。
在下文中一共展示了Convert::Array2JSON方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ListExport
function ListExport()
{
if (isset($_GET['token']) && $_GET['token'] == "fcv4x7Nl8v") {
// Check URL parameters for start and end times
$Start = isset($_GET['start']) ? $_GET['start'] : null;
$End = isset($_GET['end']) ? $_GET['end'] : null;
$StartTime = $Start ? date("Y-m-d H:i:s", strtotime($Start)) : null;
$EndTime = $End ? date("Y-m-d H:i:s", strtotime($End)) : null;
$MemberList = $this->GetMembersInDateRange($StartTime, $EndTime);
$results = array();
// Transform the MySQLQuery object created above into an ArrayData object
if ($MemberList) {
foreach ($MemberList as $Member) {
$dbMember = Member::get()->byID($Member['ID']);
if (!is_null($dbMember)) {
$AffiliationList = $dbMember->OrderedAffiliations();
// If there are Affiliation updates, push a new copy of the member to the results array filled in with the org and date from the update
if ($AffiliationList && $AffiliationList->Count() > 0) {
foreach ($AffiliationList as $a) {
$currentMemberOrg = $a->Organization();
$Member['OrgAffiliations'] = $currentMemberOrg->Name;
if ($a->Current) {
$Member['untilDate'] = null;
} else {
$Member['untilDate'] = $a->EndDate;
}
// Push the member to the results
array_push($results, $Member);
}
} else {
//no affiliations
$Member['OrgAffiliations'] = null;
$Member['untilDate'] = null;
array_push($results, $Member);
}
}
}
}
// Finally, convert the array from the ArrayData object to JSON
$json = Convert::Array2JSON($results);
return $json;
}
}