Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- JSON
- 웹하드추천
- JavaScript
- 전략
- curl
- UTF-8
- jquery
- Linux
- composer-php
- file-upload
- Forms
- Ajax
- Laravel
- Regex
- function
- OOP
- MySQL
- Arrays
- post
- php
- 웹하드순위
- 경영
- string
- date
- Session
- 무료다운로드쿠폰
- variables
- HTML
- Apache
Archives
- Today
- Total
개발! 딱 깔끔하고 센스있게!
php JSONu encode 일하지 않습니다. 본문
나는 여기서 이 JSON 에게 출력을 받고 싶다.
불행히도 jsonu encode () 함수는 이 형식으로 구성되지 않는다는 것이다.
조금도 돌아오지 않는다.
이것은 나의 비밀번호다
$output = array( 'responseData' => array(), 'responseDetails' => null, 'responseStatus' => 200 ); $x = 0; while ($row = mysqli_fetch_assoc($result)) { foreach ($row as $k => $v) { $output['responseData']['result'][$x][$k] = $v; } $x++; } print_r($output); header('Content-Type: application/json'); echo json_encode($output , JSON_FORCE_OBJECT);
나는 원인을 찾을 수 없다.
누군가가 나를 도와 해결 방법을 찾아주세요.
편집: 죄송합니다.
여기는 출력-
예상했던 JSON 출력-
{ "responseData": { "results": [{ "qid": 1, "qtitle": "When do we finish this project ?", "qimage_url": "http://www.wearesliit.com/example.png", "user": "samith", "date": "2016-01-01T02:15:12.356Z", "type": 1, "category": 5, "tags": ["common_senese", "truth", "bazsa_awsanna"], "note": "Sample quetion" }, {}, {}] }, "responseDetails": null, "responseStatus": 200 }
나는 JSON 의 출력은 전혀 없다.
그러나 이는 디지털 인쇄 결과다.
Array( [responseData] => Array ( [result] => Array ( [0] => Array ( [question_ID] => 1 [question_Title] => Which shape does not belong with the other three shapes? [question_Image_URL] => http://www.wearesliit.com/images/quiz/questions/1.jpg [quetion_Note] => Easy IQ question. [category_ID] => 7 [username] => samith [added] => 2017-01-29 21:50:52 ) [1] => Array ( [question_ID] => 2 [question_Title] => Tim earns $10 per hour at his job. When he gets paid on Friday, he is paid for 40 hours of work. He then goes out and spends 10% of his earnings on entertainment that weekend. How much money is he left with on Monday? [question_Image_URL] => [quetion_Note] => Easy IQ question. [category_ID] => 7 [username] => samith [added] => 2017-01-29 21:50:52 ) ) ) [responseDetails] => [responseStatus] => 200 )
대답
다행히 @awiebe 덕분에 확실한 잘못을 발견했습니다.
네, 그것도 좋아요.
Malformed UTF-8 characters, possibly incorrectly encoded
감사합니다.
저는 다른 문제에서 해결책을 찾았습니다.
"형식이 부정확한 UTF-8 문자, 인코딩이 잘못될 수도 있어요".
'개발 스크랩 메모 > PHP' 카테고리의 다른 글
PHP excel- 데이터 순환? (0) | 2020.12.19 |
---|---|
PHP-바꾸기 (0) | 2020.12.19 |
이미지 높이 및 너비 PHP 얻기 (0) | 2020.12.19 |
PHP cURL POST 가 지원하지 않는 미디어 형식으로 되돌아가겠습니다 (0) | 2020.12.18 |
PHP 헤더 리디렉션이 작동하지 않음 [중복] (0) | 2020.12.18 |
Comments