[PHP] json_decode 가 null 이고 Control character error, possibly incorrectly encoded 오류 메세지 대응 > 개발팁

본문 바로가기
사이트 내 전체검색

개발팁

[PHP] json_decode 가 null 이고 Control character error, possibly incorrec…

페이지 정보

본문

php 에서 json_decode 가 null 이 나왔을때 json_last_error_msg() 를 찍어보았다.

echo json_last_error_msg(); //Control character error, possibly incorrectly encoded


Control character error, possibly incorrectly encoded 이라는 메세지가 나왔다.


그럴 때에는 아래와 같이 처리하자.

$json = preg_replace('/[[:cntrl:]]/', '', $json);

$json = json_decode($json, true);

추천0 비추천0

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

사이트 정보

회사명 : 회사명 / 대표 : 대표자명
주소 : OO도 OO시 OO구 OO동 123-45
사업자 등록번호 : 123-45-67890
전화 : 02-123-4567 팩스 : 02-123-4568
통신판매업신고번호 : 제 OO구 - 123호
개인정보관리책임자 : 정보책임자명

공지사항

  • 게시물이 없습니다.

접속자집계

오늘
743
어제
1,992
최대
3,520
전체
378,597
Copyright © 소유하신 도메인. All rights reserved.