티스토리 뷰
Language/PHP
■ DB입력시 따옴표(')를 처리하는 addslashes, stripslashes 함수출처: https://wickedmagic.tistory.com/580 [사악미소의 현대마법의 공방:티스토리]
MiniNeko 2025. 1. 20. 03:35https://wickedmagic.tistory.com/580
[PHP] DB입력시 따옴표(')를 처리하는 addslashes, stripslashes 함수
■ DB입력시 따옴표(')를 처리하는 addslashes, stripslashes 함수 PHP에서 문자열에 따옴표(큰 따옴표 : ", 작은 따옴표 : ')가 들어간 내용을 DB 값으로 집어 넣을때 addslashes, stripslashes 를 사용한다.그런데
wickedmagic.tistory.com
$txtNote1 = htmlspecialchars($txtNote1);
$txtNote2 = htmlspecialchars($txtNote2);
//$txtNote1 = str_replace('\'', '?', $txtNote1);
//$txtNote2 = str_replace('\'', '?', $txtNote2);
// (') 처리
$txtNote1 = addslashes($txtNote1);
$txtNote2 = addslashes($txtNote2);
'Language > PHP' 카테고리의 다른 글
[ PHP ] 문자열 치환 : str_replace :: 포함 찾기 : strpos (0) | 2021.02.04 |
---|---|
[ PHP ] 문자열 자르기 : mb_substr (0) | 2021.02.04 |
[ PHP ] 넘긴 변수가 자동으로 언어셋이 변경되는 것을 체크하여 UTF-8 로 변경하기 (0) | 2019.02.12 |
[ PHP ] 날자 시간 - date time - 현재 년월일 시분초 // 한글요일 (0) | 2017.04.06 |
[ PHP ] 문자열중에 숫자만 가져오기 함수 (0) | 2017.04.06 |