发布时间:2015-11-21 21:54:56 作者:佚名 阅读:(1440)
判断一个字符串是否属于序列化后的数据
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; }
欢迎分享转载→ PHP判断是否是序列化字符串数据的函数
Deprecated: Methods with the same name as their class will not be constructors
(2786)人喜欢 2022-04-19if condition多个值_thinkphp if标签的condition用法
(2940)人喜欢 2022-04-19PHP获取今日、昨日、上周、本月的起始时间戳和结束时间戳的方法
(54)人喜欢 2019-06-11PHP判断是否是序列化字符串数据的函数
(1440)人喜欢 2015-11-21php数组排序详解
(34)人喜欢 2015-11-21php文件怎么打开
(252)人喜欢 2015-11-21© 2015-2021 - 吾爱编程网 版权所有 苏ICP备18033726号-1关于我们 - 网站声明 - 联系我们