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


PHP Json::Decode方法代碼示例

本文整理匯總了PHP中Json::Decode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Json::Decode方法的具體用法?PHP Json::Decode怎麽用?PHP Json::Decode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Json的用法示例。


在下文中一共展示了Json::Decode方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct($Section)
 {
     $this->Section = $Section;
     $Data = Json::Decode("lang/{$Section}.json");
     if (is_array($Data)) {
         $this->Data = $Data;
     } else {
         Std::Out("[Warning] [Lang] Can't load lang/{$Section}.json");
     }
 }
開發者ID:kumar003vinod,項目名稱:WhatsBot,代碼行數:10,代碼來源:Lang.php

示例2: LoadFile

 private static function LoadFile($File)
 {
     if (substr($File, strlen($File) - 5) !== '.json') {
         $File .= '.json';
     }
     $Data = Json::Decode("config/{$File}");
     if (is_array($Data)) {
         return self::$Config[substr($File, 0, strlen($File) - 5)] = $Data;
     }
     return false;
 }
開發者ID:kumar003vinod,項目名稱:WhatsBot,代碼行數:11,代碼來源:Config.php

示例3: Load

 public final function Load()
 {
     if (!is_string($this->Extension) || extension_loaded($this->Extension)) {
         if ($this->ModuleManager->KeyExists($this->Key)) {
             $this->Path = "class/Modules/{$this->Key}_{$this->AliasOf}";
             $this->JPath = $this->Path . '.json';
             $this->XPath = $this->Path . '.' . $this->PathExtension;
             if (basename(dirname(realpath($this->JPath))) === 'Modules') {
                 $Json = Json::Decode($this->JPath);
                 if (is_array($Json)) {
                     if (is_readable($this->XPath)) {
                         // Lint
                         $this->Data = $Json;
                         if (isset($this->Data['Libs']) && is_array($this->Data['Libs'])) {
                             foreach ($this->Data['Libs'] as $Lib) {
                                 if (!LoadLib($Lib)) {
                                     Std::Out("[Warning] [Modules] Can't load {$this->Key}::{$this->Name} ({$this->AliasOf}). {$Lib} lib doesn't exists");
                                     $this->Loaded = self::NOT_LOADED;
                                     return $this->Loaded;
                                 }
                             }
                         }
                         $this->Loaded = $this->_Load();
                         return $this->Loaded;
                     } else {
                         Std::Out("[Warning] [Modules] Can't load {$this->Key}::{$this->Name} ({$this->AliasOf}). {$this->PathExtension} file is not readable");
                     }
                 } else {
                     Std::Out("[Warning] [Modules] Can't load {$this->Key}::{$this->Name} ({$this->AliasOf}). Json file is not decodeable");
                 }
             } else {
                 Std::Out("[Warning] [Modules] Can't load {$this->Key}::{$this->Name} ({$this->AliasOf}). It is not in Modules folder");
             }
         } else {
             Std::Out("[Warning] [Modules] Can't load {$this->Key}::{$this->Name} ({$this->AliasOf}). That key doesn't exists");
         }
     } else {
         Std::Out("[Warning] [Modules] Can't load {$this->Key}::{$this->Name} ({$this->AliasOf}). {$this->Extension} extension is not loaded");
     }
     $this->Loaded = self::NOT_LOADED;
     return $this->Loaded;
 }
開發者ID:kumar003vinod,項目名稱:WhatsBot,代碼行數:42,代碼來源:Module.php

示例4: Load

 public final function Load()
 {
     if (!is_string($this->Extension) || extension_loaded($this->Extension)) {
         $this->Path = __DIR__ . "/Threads/{$this->Name}";
         $this->JPath = $this->Path . '.json';
         $this->XPath = $this->Path . '.' . $this->PathExtension;
         if (basename(dirname(realpath($this->JPath))) === 'Threads') {
             $Json = Json::Decode($this->JPath);
             if (is_array($Json)) {
                 if (is_readable($this->XPath)) {
                     // Lint
                     $this->Data = $Json;
                     if (isset($this->Data['Libs']) && is_array($this->Data['Libs'])) {
                         foreach ($this->Data['Libs'] as $Lib) {
                             if (!LoadLib($Lib)) {
                                 Std::Out("[Warning] [Threads] Can't load {$this->Name}. {$Lib} lib doesn't exists");
                                 $this->Loaded = self::NOT_LOADED;
                                 return $this->Loaded;
                             }
                         }
                     }
                     $this->Loaded = $this->_Load();
                     return $this->Loaded;
                 } else {
                     Std::Out("[Warning] [Threads] Can't load {$this->Name}. {$this->PathExtension} file is not readable");
                 }
             } else {
                 Std::Out("[Warning] [Threads] Can't load {$this->Name}. Json file is not decodeable");
             }
         } else {
             Std::Out("[Warning] [Threads] Can't load {$this->Name}. It is not in Threads folder");
         }
     } else {
         Std::Out("[Warning] [Threads] Can't load {$this->Name}. {$this->Extension} extension is not loaded");
     }
     $this->Loaded = self::NOT_LOADED;
     return $this->Loaded;
 }
開發者ID:hasanalom,項目名稱:WhatsBot,代碼行數:38,代碼來源:Thread.php


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