2017-10-16 185 views
0

我有一個巨大的40GB JSON文件的工作,我使用JSON解析器拉爲PHP 7提取從巨大的文件數據。這裏是my dummy json file致命錯誤:未捕獲的錯誤:類「IntlChar」未找到

我想在一個表的形式,從而提取屬性「entityStatusDescription」數據:

`ENTITYSTATUSDESCRIPTION` 
     `removed` 
    `registered` 
     `removed` 
     `removed` 
    `registered` 
     `removed` 

我能提取其他屬性數據,而是從屬性entityStatusDescription提取數據時,只有少數中提取的,然後有一個錯誤行:

Fatal error: Uncaught Error: Class 'IntlChar' not found in E:\xampp\htdocs\vendor\pcrov\jsonreader\src\Parser\Lexer.php:285 Stack trace: #0 E:\xampp\htdocs\vendor\pcrov\jsonreader\src\Parser\Lexer.php(161): pcrov\JsonReader\Parser\Lexer->evaluateEscapedUnicodeSequence() #1 E:\xampp\htdocs\vendor\pcrov\jsonreader\src\Parser\Lexer.php(191): pcrov\JsonReader\Parser\Lexer->evaluateEscapeSequence() #2 E:\xampp\htdocs\vendor\pcrov\jsonreader\src\Parser\Lexer.php(101): pcrov\JsonReader\Parser\Lexer->evaluateDoubleQuotedString() #3 [internal function]: pcrov\JsonReader\Parser\Lexer->getIterator() #4 E:\xampp\htdocs\vendor\pcrov\jsonreader\src\Parser\Parser.php(180): IteratorIterator->next() #5 E:\xampp\htdocs\vendor\pcrov\jsonreader\src\Parser\Parser.php(152): pcrov\JsonReader\Parser\Parser->parsePair() #6 E:\xampp\htdocs\vendor\pcrov\jsonreader\src\Parser\Parser.php(205): pcrov\JsonReader\Parser\Parser->parseObject() #7 E:\xampp\htdocs\vendor\pcrov\jsonreader\src\Parser\Parser.php(123): pcrov\JsonReader\Parser\Parser->parseValue in E:\xampp\htdocs\vendor\pcrov\jsonreader\src\Parser\Lexer.php on line 285

我會很樂意幫忙。這裏是我的代碼:

<?php 
    require_once "E:/xampp/htdocs/vendor/autoload.php";  
    use \pcrov\JsonReader\JsonReader; 
    ini_set("max_execution_time", 0); 
    $reader = new JsonReader(); 
    $reader->open("jsonfile.json");  
    $fo = fopen("csvfile.csv", "w"); 
    fputs($fo, "companyStatus".PHP_EOL); 
    while($reader->read()) { 


     if ($reader->read("entityStatusDescription")){ 
      $entityStatusDescription = $reader->value(); 
     } 
     fputs($fo, $entityStatusDescription.PHP_EOL); 

    } 
    $reader->close(); 
+0

你如何安裝'JsonReader'?據其['composer.json'](https://github.com/pcrov/JsonReader/blob/master/composer.json#L21)文件,它要求'EXT-intl'擴展。你不應該已經能夠在沒有該擴展 – Phil

回答

2

當您收到此錯誤消息時,您需要安裝Intl擴展。

請參考PHP手冊:

+0

感謝安裝。我採取了以下步驟銘記我使用Windows:(1)備份我的htdocs文件夾在xampp。 (2)卸載xampp,(3)重新安裝xampp,(4)打開xampp \ php目錄中的php.ini文件,並簡單地通過刪除前面的分號取消擴展名「extension = php_intl.dll」 )下載並運行 「作曲-的Setup.exe」,(6)安裝被稱爲 「pcrov/jsonreader」 流pull解析器。這是通過粘貼完成「作曲家需要pcrov/jsonreader」的命令提示符下,你希望它是目錄(例如\ XAMPP \ htdocs中)。此後,我沒有錯誤消息。 – William

+0

在取消在php.ini延伸當時的至關重要的一步。 – Gordon

相關問題