當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Convert::Array2JSON方法代碼示例

本文整理匯總了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;
     }
 }
開發者ID:Thingee,項目名稱:openstack-org,代碼行數:43,代碼來源:MemberListPage.php


注:本文中的Convert::Array2JSON方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。