首页 > 代码库 > debug $mysqli->character_set_name();
debug $mysqli->character_set_name();
<?php$mysqli = new mysqli(‘localhost‘, ‘root‘, ‘‘, ‘w‘);if(mysqli_connect_errno()){ printf(‘Connect failed: %s\n‘, mysqli_connect_errno()); exit();}$charset = $mysqli->character_set_name(); //Initial character set //latin1//Sets the default character set to be used when sending data from and to the database server. BOOLif($charset !== ‘utf8‘) $mysqli->set_charset(‘utf8‘);$charset = $mysqli->character_set_name(); //Current character set //utf8
<?php$mysqli = new mysqli(‘localhost‘, ‘root‘, ‘‘, ‘w‘);if(mysqli_connect_errno()){ printf(‘Connect failed: %s\n‘, mysqli_connect_errno()); exit();}if(!$mysqli->set_charset(‘utf8‘))echo $mysqli->error;
if(!$mysqli->set_charset(‘2utf8‘))echo $mysqli->error; //Invalid characterset or character set not supportedif(!$mysqli->set_charset(‘utf-8‘))echo $mysqli->error; //Invalid characterset or character set not supportedif(!$mysqli->set_charset(‘UTF-8‘))echo $mysqli->error; //Invalid characterset or character set not supported
debug $mysqli->character_set_name();
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。