当前位置: 首页>>代码示例>>PHP>>正文


PHP Json::json_encode方法代码示例

本文整理汇总了PHP中Json::json_encode方法的典型用法代码示例。如果您正苦于以下问题:PHP Json::json_encode方法的具体用法?PHP Json::json_encode怎么用?PHP Json::json_encode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Json的用法示例。


在下文中一共展示了Json::json_encode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: runAction

 public function runAction()
 {
     require $this->fileName;
     $o = $this->objName;
     mgTrace();
     $tmp = new $o();
     mgTrace(false);
     mgDebug('Create Module', $tmp);
     mgTrace();
     $output = $tmp->runModule($this->args);
     mgTrace(false);
     mgDebug('Run Module', $tmp);
     $this->stack['action']['content_type'] = "content-Type: text/html; charset={$this->stack['static_var']['charset']}";
     header($this->stack['action']['content_type']);
     echo Json::json_encode($output);
 }
开发者ID:baijd,项目名称:magike,代码行数:16,代码来源:action.json_output.php

示例2: floatval

                    if (mb_strpos(mb_strtoupper($r['ground']), mb_strtoupper($Transact_array_)) !== false) {
                        // echo 'YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS';
                        // echo '<'.$r['ground'].'=='.$Transact_array_.'><br>';
                        $flag = true;
                        $ArrayCategories[$i][3] = floatval($ArrayCategories[$i][3] + floatval($r['Sum_']));
                    }
                }
            }
            if (!$flag and floatval($r['Sum_']) != 0) {
                $rows[] = array('Sum' => $r['Sum_'], 'Ground' => $r['ground']);
            }
        }
        //  print_r($rows);
        // print_r($ArrayCategories);
        foreach ($ArrayCategories as $ArrayCategories_) {
            if (floatval($ArrayCategories_[3]) != 0) {
                $rows[] = array('Sum' => $ArrayCategories_[3], 'Ground' => $ArrayCategories_[1]);
            }
        }
        //На всякий случай пишем сгуппированные данные в таблицу
        $sql = "delete from categoryoperations where  LoginId=" . $loginid;
        $delCatOper = query($sql);
        foreach ($rows as $rows_) {
            $sql = "insert into categoryoperations (LoginId,Sum,CategoryText) \n                     values ('" . $loginid . "','" . $rows_['Sum'] . "','" . $rows_['Ground'] . "' )";
            //echo $sql;
            $addCatOper = query($sql);
        }
        //--------------------------------------------------------
        echo Json::json_encode($rows);
    }
}
开发者ID:bobans1985,项目名称:my-finances,代码行数:31,代码来源:data.json.php

示例3: SBERRestAccount


//.........这里部分代码省略.........
     $xpath = new DOMXPath($doc);
     $CardProductName = $xpath->query('//div[@class="productCover activeProduct"]//span[@class="mainProductTitle mainProductTitleLight"]');
     //$CardProductName = $xpath->query('//span[@class="mainProductTitle mainProductTitleLight"]');
     $CardNumber = $xpath->query('//div[@class="accountNumber decoration-none"]');
     $CardAmount = $xpath->query('//span[@class="overallAmount nowrap"] | //span[@class="overallAmount nowrap negativeAmount"]');
     $CardhRef = $xpath->query('//div[@class="productName"]//a[contains(@href,"/PhizIC/private/cards/info.do?id=")]');
     $CardsArray = '';
     $ArrayAccountID = '';
     $logger->addInfo('Count CardProductName=' . count($CardProductName));
     $logger->addInfo('Count CardNumber=' . count($CardNumber));
     $logger->addInfo('Count CardAmount=' . count($CardAmount));
     $logger->addInfo('Count CardhRef=' . count($CardhRef));
     $i = 0;
     foreach ($CardProductName as $CardProductName_) {
         $logger->addInfo('for I=' . $i);
         $logger->addInfo('CardProductName:' . GetCardProductNameSber($CardProductName_));
         $logger->addInfo('CardNumber:' . GetCardNumberSber($CardNumber->item($i)));
         $logger->addInfo('CardAmount:' . nodeContent($CardAmount->item($i)));
         $logger->addInfo('CardhRef:' . GetCardhRefValueSber($CardhRef->item($i)));
         $CardsArray[] = GetCardProductNameSber($CardProductName->item($i));
         $CardsArray[] = GetCardNumberSber($CardNumber->item($i));
         $CardsArray[] = nodeContent($CardAmount->item($i));
         $CardsArray[] = GetCardhRefValueSber($CardhRef->item($i));
         $ArrayAccountID[] = GetCardhRefValueSber($CardhRef->item($i));
         //Попробуем с кодами валют
         $logger->addInfo('CurrCode:' . CurrCodeSber($CardAmount->item($i)));
         $CardsArray[] = CurrCodeSber($CardAmount->item($i));
         $i++;
     }
     $json = array("AccountsList" => array(), "CardList" => array(), "AcountStatements" => array());
     $logger->addInfo('>>>>>RealResult starting');
     $logger->addInfo('Count Array=' . count($CardsArray));
     for ($i = 0; $i < count($CardsArray) / 5; $i++) {
         for ($j = 0; $j < 5; $j++) {
             //echo ('i='.$i.';j='.$j.'<br>');
             switch ($j) {
                 case 0:
                     $logger->addInfo('CardProductName:' . $CardsArray[$i * 5 + $j]);
                     $CardType = $CardsArray[$i * 5 + $j];
                     break;
                 case 1:
                     $logger->addInfo('CardNumber:' . $CardsArray[$i * 5 + $j]);
                     $CardNumber = $CardsArray[$i * 5 + $j];
                     break;
                 case 2:
                     $logger->addInfo('CardAmount:' . $CardsArray[$i * 5 + $j]);
                     $Rest = str_replace(",", ".", str_replace(' ', '', $CardsArray[$i * 5 + $j]));
                     break;
                 case 3:
                     $logger->addInfo('CardhRef:' . $CardsArray[$i * 5 + $j]);
                     $CardID = $CardsArray[$i * 5 + $j];
                     break;
                 case 4:
                     $logger->addInfo('CurrCode:' . $CardsArray[$i * 5 + $j]);
                     $CurrCode = $CardsArray[$i * 5 + $j];
                     break;
                 default:
                     break;
             }
         }
         if ($CardType != '') {
             $json["CardList"][] = array("CardType" => $CardType, "CardNumber" => $CardNumber, "Rest" => $Rest, "CardID" => $CardID, "CurrCode" => $CurrCode);
         }
     }
     //https://online.sberbank.ru/PhizIC/private/cards/print.do?id=9045783&printAbstract=true
     /*
     foreach ($ArrayAccountID as $ArrayAccountID_)
         {
       //  sel:c:9045783
     //fromDateString:01/01/2014
     //toDateString:03/03/2014
       //  $postData= 'fromDateString=01/01/2014&toDateString=03/0132014&sel:c:9045783';
         $data=  http_request('https://online.sberbank.ru/PhizIC/private/accounts/print.do?sel=c:'.$ArrayAccountID_.'&fromDateString=01/01/2014&toDateString=03/03/2014',true, '' ,false,$cookie,'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537',30);
         if (!$data) {
                $logger->addError('не можем получить информацию по выписке');
                //return 'не можем получить информацию по выписке';
            }
         $logger->addDebug('DATA5_STATEMENT1:'.$data.'END DATA5_STATEMENT1');
     
     
          $body=substr($data,strpos($data, 'body=')+5,-8);
          $logger->addDebug('DATA5:'.$body.'END DATA 5');
        
          $doc->loadHTML($body);
          libxml_clear_errors();
          $xpath = new DOMXPath($doc);
     
     $logger->addInfo('STATEMENT7:');
           //Выписка                      
          $TableTrStatement = $xpath->query('//table');
                    foreach ($TableTrStatement as $tag1) {
                       $logger->addInfo('NodeContent1:'.($tag1->nodeValue));
               }  
              
         
         }*/
     $logger->addInfo('Good result: ' . Json::json_encode($json));
     $logger->addInfo('End SBERRestAccount class');
     return Json::json_encode($json);
 }
开发者ID:bobans1985,项目名称:my-finances,代码行数:101,代码来源:JsonServerClass.php


注:本文中的Json::json_encode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。