略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: mb_check_encoding

2024-05-04

mb_check_encoding

(PHP 4 >= 4.4.3, PHP 5 >= 5.1.3, PHP 7, PHP 8)

mb_check_encoding检查字符串在指定的编码里是否有效

说明

mb_check_encoding(string $var = null, string $encoding = mb_internal_encoding()): bool

检查指定的字节流在指定的编码里是否有效。它能有效避免所谓的“无效编码攻击(Invalid Encoding Attack)”。

参数

var

要检查的字节流。如果省略了这个参数,此函数会检查所有来自最初请求所有的输入。

encoding

期望的编码。

返回值

成功时返回 true, 或者在失败时返回 false

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/function.mb-check-encoding.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3