Hướng dẫn jsonlint-php - jsonlint-php
Show Cách sử dụnguse Seld\JsonLint\JsonParser; $parser = new JsonParser(); // returns null if it's valid json, or a ParsingException object. $parser->lint($json); // Call getMessage() on the exception object to get // a well formatted error message error like this // Parse error on line 2: // ... "key": "value" "numbers": [1, 2, 3] // ----------------------^ // Expected one of: 'EOF', '}', ':', ',', ']' // Call getDetails() on the exception to get more info. // returns parsed json, like json_decode() does, but slower, throws // exceptions on failure. $parser->parse($json); Bạn cũng có thể chuyển các cờ bổ sung cho
Example: $parser = new JsonParser; try { $parser->parse(file_get_contents($jsonFile), JsonParser::DETECT_KEY_CONFLICTS); } catch (DuplicateKeyException $e) { $details = $e->getDetails(); echo 'Key '.$details['key'].' is a duplicate in '.$jsonFile.' at line '.$details['line']; }
Cài đặtĐể cài đặt nhanh với nhà soạn nhạc sử dụng:
JSON Lint có thể dễ dàng được sử dụng trong một ứng dụng khác nếu bạn có trình tải tự động PSR-4 hoặc nó có thể được cài đặt thông qua trình soạn thảo để sử dụng làm CLI sử dụng. Sau khi được cài đặt thông qua Trình soạn thảo, bạn có thể chạy lệnh sau để xua lại tệp JSON hoặc URL: Yêu cầu
Gửi lỗi và yêu cầu tính năngLỗi và yêu cầu tính năng được theo dõi trên github Tác giảJordi Boggiano - - http://twitter.com/seldaek Giấy phépJSON Lint được cấp phép theo giấy phép MIT - xem hồ sơ cấp phép để biết chi tiết Sự nhìn nhậnThư viện này là một cổng của Thư viện JsonLint JavaScript. Được cung cấp bởi: jsonlint_1.4.0-1build1_all TÊNjsonlint-php - JSON Lint command line interface TÓM TẮTjsonlint file [options] TÙY CHỌN-q, --quiet Cause jsonlint to be quiet when no errors are found -h, --help Show this message JsonLint -php - giao diện dòng lệnh json lint Tệp JsonLint-Php [Tùy chọn] file [options] Ký hiệu đối tượng JavaScript
Không có người dùng đóng góp ghi chú cho trang này. |