duangu4943 2012-11-24 23:45
浏览 27
已采纳

确定返回的代码格式

I am trying to find out what this format is:

a:2:{i:0;s:2:"29";i:1;s:2:"30";}

It kind of looks like json. To give background information I am using php/drupal with the webform module and submitting a form returns one of the input fields as this value for a fileupload box.

I am trying to get the 29 and 30. Hopefully there is an easy way to grab those two numbers without having to parse the string using regular expressions.

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • dpzo13732 2012-11-24 23:48
    关注

    This is a serialized array.

    You can get the value with PHP by:

    $value = unserialize('a:2:{i:0;s:2:"29";i:1;s:2:"30";}');

    You can read more here: http://php.net/manual/en/function.serialize.php

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据