2016-09-17 69 views
-1
Cleeng_Entity_Collection Object 
(
    [entityType:protected] => Cleeng_Entity_SubscriptionOffer 
    [items:protected] => Array 
     (
      [0] => Cleeng_Entity_SubscriptionOffer Object 
       (
        [id:protected] => S955494970_US 
        [publisherEmail:protected] => [email protected] 
        [url:protected] => 
        [title:protected] => Annual subscription 
        [description:protected] => 
        [period:protected] => year 
        [price:protected] => 49.99 
        [applicableTaxRate:protected] => 0 
        [currency:protected] => USD 
        [accessToTags:protected] => Array 
         (
          [0] => d962607d3d4c4e3c98a343c7bcb64027 
         ) 

        [active:protected] => 1 
        [createdAt:protected] => 1473681112 
        [updatedAt:protected] => 1473858745 
        [geoRestrictionEnabled:protected] => 
        [geoRestrictionType:protected] => 
        [geoRestrictionCountries:protected] => Array 
         (
         ) 

        [pending:protected] => 
        [country] => US 
        [socialCommissionRate] => 0 
        [averageRating] => 4 
        [contentType] => 
        [freePeriods] => 0 
        [freeDays] => 0 
        [expiresAt] => 
       ) 
     ) 
    [totalItemCount:protected] => 5 
    [pending:protected] => 
) 

回答

0

轉換所有您需要做的僅僅是集合轉換成規則排列,然後json_encode()的結果,像這樣:

<?php 

    $entityCollection = "???"; // THIS IS THE DATA FROM Cleeng_Entity_Collection Object 
    $entityArray  = $entityCollection->toArray(); 
    $entityJSON  = json_encode($entityArray); 
+0

我不能夠得到保護的數據。我怎樣才能得到它 – solomon

+0

我們可以將未受保護的數據更改爲json ....但我需要受保護的數據來更改JSON – solomon