Rumah > Artikel > pembangunan bahagian belakang > mysql 口字符号怎么处理?
mysql 口字符号怎么处理?
mysql 字段是text的,遇到 口字符号就会自动从这里断开,后面的内容无法入库。使用addslashes函数无效。
口字符号就是比口字细那种,不知道是乱码还是无法显示的字符。
就是图中的这个符号
□ 是你输入的吗?
□ 是你输入的吗?
□ 是你输入的吗?
设取到的内容在 $s 中(当然要含有那个字符的)
echo base64_encode($s);
贴出结果
设取到的内容在 $s 中(当然要含有那个字符的)
echo base64_encode($s);
贴出结果
$s = '44CQ6IuP55CzVEVBTeiDtuWOn+ibi+eZveWPjemmiPCfmYjwn5mI44CR5pys5p2l6YO96KaB552h5LqG44CC56qB54S25p2l5LqG6IO25Y6f6JuL55m955qE5Y+N6aaI8J+YgvCfmILlpKfljYrlpJznmoTvvIzkvaDov5norqnnvqTph4znmoTnlLfku6PnkIbku6zmgI7kuYjmtLvwn5iz5Y2B5LqU5aSp55qE5pWI5p6c77yM5bCx5piv6L+Z5LmI54mb6YC84pyM54Wn6L+Z5Liq6LaL5Yq/5LiL5Y6777yM5LiA5Liq55aX56iL5LiN5q2i5aSn5LiA5LiqY3Vw5LqG5ZCn8J+Ysei/meWwseaYr+iDtuWOn+ibi+eZveS4uuWVpei/meS5iOeBq+eahOaEv+aEj++8gfCfkYrwn5GK5LiA55aX56iL5peg5pWI6YCA5qy+77yB5bCx5piv5pyJ5bqV5rCU4pyMd2VpeGluOnN1bGluMDkwOA==';$s = base64_decode($s);//echo $s, PHP_EOL;preg_match_all('/./u', $s, $m);//print_r($m[0]);echo bin2hex($m[0][13]);f09f9988
$text = preg_replace_callback('/[\xf0-\xf7].{3}/', function($r) { return '@E' . base64_encode($r[0]);}, $text);
特殊字符,可以替?一下??理。
$s = '44CQ6IuP55CzVEVBTeiDtuWOn+ibi+eZveWPjemmiPCfmYjwn5mI44CR5pys5p2l6YO96KaB552h5LqG44CC56qB54S25p2l5LqG6IO25Y6f6JuL55m955qE5Y+N6aaI8J+YgvCfmILlpKfljYrlpJznmoTvvIzkvaDov5norqnnvqTph4znmoTnlLfku6PnkIbku6zmgI7kuYjmtLvwn5iz5Y2B5LqU5aSp55qE5pWI5p6c77yM5bCx5piv6L+Z5LmI54mb6YC84pyM54Wn6L+Z5Liq6LaL5Yq/5LiL5Y6777yM5LiA5Liq55aX56iL5LiN5q2i5aSn5LiA5LiqY3Vw5LqG5ZCn8J+Ysei/meWwseaYr+iDtuWOn+ibi+eZveS4uuWVpei/meS5iOeBq+eahOaEv+aEj++8gfCfkYrwn5GK5LiA55aX56iL5peg5pWI6YCA5qy+77yB5bCx5piv5pyJ5bqV5rCU4pyMd2VpeGluOnN1bGluMDkwOA==';$s = base64_decode($s);//echo $s, PHP_EOL;preg_match_all('/./u', $s, $m);//print_r($m[0]);echo bin2hex($m[0][13]);f09f9988
$text = preg_replace_callback('/[\xf0-\xf7].{3}/', function($r) { return '@E' . base64_encode($r[0]);}, $text);