PHP substr intercepts English dot and turns it into garbled code

Time:2021-6-14

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 is the number of bytes intercepted, MB_ If substr is intercepted according to the number of logical fields, the above situation will occur. See  https://bugs.php.net/bug.php?id=66069