특수문자 ????? DB에 기록하는 방법
본문
<?php
include_once('../../common.php');
define('cherry', 0);
define('orange', 1);
define('prune', 2);
define('bell', 3);
define('seven', 4);
define('bar1', 5);
define('bar2', 6);
define('bar3', 7);
define('anyBar', 8);
if($member['mb_point'] < 10) {
alert('슬롯머신 배팅에 필요한 포인트가 없습니다.', '/');
}
insert_point($member['mb_id'], -10, 'Vegas플레이 비용');
$profits = array(
array(10, 30, 120), // cherry
array(0, 0, 100), // orange
array(0, 0, 200), // prune
array(0, 0, 500), // bell
array(0, 0, 5000), // seven
array(0, 0, 300), // bar1
array(0, 0, 2000), // bar2
array(0, 0, 4000), // bar3
array(0, 0, 80) // anybar
);
$slotName = array(
'?',
'?',
'?',
'?',
'?',
'1️',
'2️',
'3️',
);
$slots = array(
array(
cherry, orange, cherry, bar2, prune, bar1, bell, orange,
cherry, orange, bar3, prune, cherry, bell, bar1, orange,
cherry, seven, prune, orange, cherry
),
array(
orange, cherry, bar1, prune, orange, bar2, bell, cherry,
bar3, orange, bar1, prune, cherry, orange, bell, bar2,
seven, cherry, bar1, prune, orange, cherry
),
array(
orange, cherry, bar1, bell, bar3, prune, orange, bar2,
cherry, prune, bell, seven, bar1, bar3, orange, bar2,
cherry, bell, prune, bar1, orange
)
);
$maxSpin = array(20, 21, 20);
$spin = array();
$spin[0] = rand(0, $maxSpin[0]);
$spin[1] = rand(0, $maxSpin[1]);
$spin[2] = rand(0, $maxSpin[2]);
$matchCount = 0;
$matched = $slots[0][$spin[0]];
if($matched == $slots[1][$spin[1]]) {
$matchCount++;
} else if(($matched > seven) && ($slots[1][$spin[1]] > seven)) {
$matched = anyBar;
$matchCount++;
}
if($matched == $slots[2][$spin[2]]) {
if($matchCount > 0) $matchCount++;
} else if(($matched > seven) && ($slots[2][$spin[2]] > seven)) {
if($matchCount > 0) {
$matched = anyBar;
$matchCount++;
}
}
if($profits[$matched][$matchCount] != 0) {
insert_point($member['mb_id'], $profits[$matched][$matchCount], G5_TIME_YMD.' Vegas플레이 수익 ['.$slotName [$slots[0][$spin[0]]].$slotName [$slots[1][$spin[1]]].$slotName [$slots[2][$spin[2]]].']');
}
echo '{"slot1":'.$spin[0].',"slot2":'.$spin[1].',"slot3":'.$spin[2].'}';
출처: https://sir.kr/g5_plugin/9824
위 소스에서 특수문자 ????? 가 디비에 기록될때는 2022-02-21 Vegas플레이 수익 [???]로 나옵니다.
숫자 1,2,3은 제대로 기록되고 특수문자만 디비에 기록될때 ? 물음표로 기록되던데
검색으로 찾을수가 없어서 질문드려봅니다.
특수문자를 db에 제대로 넣고 보여주려면 어떻게 해야하나요..
아래는 테이블 구조입니다. 혹시 필요한 정보일까 싶어서요.
추가:
질문 글쓸때는 특수문자가 잘 보이더니.. 저장하고 나니 물음표로 나오는군요.. 사진으로 올립니다
위 그림문자가 다 ???? 로 나온겁니다. ㅜㅜ;
!-->답변 2
mysql character set을 utf8mb4로 해 보세요.
답변감사합니다.
말씀하신데로 바꾸려는데 문제가 발생하네요.
바꾸고 실행하면
이런 에러가 나옵니다. 왜 엄한 필드의 에러가.. ㅜㅜ;;
검색으로 my.ini를 바꿔야 한다길래 아래처럼 바꾼 상태입니다.
확인해보면 아래처럼 나옵니다.
현재 이모지문자가 ?로 나옵니다. 변함없습니다.
답변을 작성하시기 전에 로그인 해주세요.