您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP判断是否是序列化字符串数据的函数

2024/6/15 13:43:00发布19次查看
判断一个字符串是否属于序列化后的数据
function is_serialized( $data ) { $data = trim( $data ); if ( 'n;' == $data ) return true; if ( !preg_match( '/^([adobis]):/', $data, $badions ) ) return false; switch ( $badions[1] ) { case 'a' : case 'o' : case 's' : if ( preg_match( /^{$badions[1]}:[0-9]+:.*[;}]\$/s, $data ) ) return true; break; case 'b' : case 'i' : case 'd' : if ( preg_match( /^{$badions[1]}:[0-9.e-]+;\$/, $data ) ) return true; break; } return false; }
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product