PHP substr 截取英文点号变成乱码
substr('6tTPnWsXBBmF5FZ2·mPbpBcZh8D76PrBP~', 16, 1);
E:\Apache\htdocs\site\application\controllers\Welcome.php:16:string '�' (length=1)
mb_substr('6tTPnWsXBBmF5FZ2·mPbpBcZh8D76PrBP~', 16, 1);
E:\Apache\htdocs\site\application\controllers\Welcome.php:17:string '·' (length=2)
substr 是按字节数截取,mb_substr 是按逻辑字段个数截取,才会出现上述情况,可参阅 https://bugs.php.net/bug.php?id=66069