我有一個巨大的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();
你如何安裝'JsonReader'?據其['composer.json'](https://github.com/pcrov/JsonReader/blob/master/composer.json#L21)文件,它要求'EXT-intl'擴展。你不應該已經能夠在沒有該擴展 – Phil