本文章提供这三款php 截取字符串函数各有各的特点,所有字符串截取函数都支持中文汉字截取,解决了乱码问题,方法二,支持多种编码的截取。
//字符串截取函数一
代码如下 | 复制代码 |
function mystr($str,$str_len) {//剪取一定长度的字符串(字符串,剪取长度) |
//字符截取函数二
代码如下 | 复制代码 |
function syssubstr($string,$length,$append = false) $string = ""; |
// utf-8:$byte=3 | gb 2312:$byte=2 | big5:$byte=2
代码如下 | 复制代码 |
function bite_str($string, $start, $len, $byte=3) // test |
//方法四,支持中英文字符串截取函数
代码如下 | 复制代码 |
function ccstrlen($str) #计算中英文混合字符串的长度 |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
