报错一:GBK编码下的htmlspecialchars异常:使用htmlspecialchars会输出空白。htmlspecialchars
string htmlspecialchars ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $charset [, bool $double_encode = true ]]] )
第三个参数支持传入编码,但是参照手册,中文仅仅支持GB2312,而一些生僻字就不能正常显示了。如果传入GBK则会提示如下错误:
Warning: htmlspecialchars(): charset `gbk' not supported, assuming utf-8 in
正确的解决办法是:
ini_set('default_charset','gbk');
htmlspecialchars($str,ENT_COMPAT,'');
An empty string activates detection from script encoding (Zend multibyte), default_charset and current locale (see nl_langinfo() and setlocale()), in this order. Not recommended. (中文手册未翻译) 传入空字符串则使用default_charset的编码。
报错二:mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication.
在stackoverflow有解决办法的说明。需要注意的是:my.cnf要在正确的配置段加;navicat默认生成的函数是OLD_PASSWORD。
» 阅读全文
Follow Me