使用 PHP 删除字符串的前 4 个字符
如何使用 PHP 删除字符串的前 4 个字符?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
如何使用 PHP 删除字符串的前 4 个字符?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
您可以使用
substr
函数返回子字符串从第5个字符开始:You could use the
substr
function to return a substring starting from the 5th character:如果您使用的是多字节字符编码,并且不想像
substr
那样只删除前四个字节,请使用多字节对应的mb_substr
。这当然也适用于单字节字符串。If you’re using a multi-byte character encoding and do not just want to remove the first four bytes like
substr
does, use the multi-byte counterpartmb_substr
. This does of course will also work with single-byte strings.