2013-04-25 20:34
浏览 56


I want to get a specific value out of a MySql database.

I have:

SELECT option_value 
FROM wp_options 
WHERE option_name = 'DevloungePluginSeriesAdminOptions'

Which outputs:


I think this is some sort of array. I don't know how handle it. I only want the 155000009-9a5sg2t42q2k0159ko8hkdo85hjlu69j part of the string.

How can I get just 155000009-9a5sg2t42q2k0159ko8hkdo85hjlu69j?

图片转代码服务由CSDN问答提供 功能建议



  SELECT option_value 
FROM wp_options 
WHERE option_name ='DevloungePluginSeriesAdminOptions'

哪些输出:< / p>

 <代码>一个:4:{S:11: “add_content”; S:4: “真”; S:7: “内容”; S:45:“155000009-9a5sg2t42q2k0159ko8hkdo85hjlu69j  “; S:11:” show_header “; S:4:” 真 “; S:14:” COMMENT_AUTHOR “; S:4:” 真“;} 
 < 我认为这是某种阵列。 我不知道怎么处理它。 我只想要 155000009-9a5sg2t42q2k0159ko8hkdo85hjlu69j 部分字符串。 

如何才能获得 155000009-9a5sg2t42q2k0159ko8hkdo85hjlu69j

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duanbi8089 2013-04-25 21:08

    This data is in serialized format. You need to unserialize it before extracting the array value.

    Suppose result object is $result, then following code will work:

    $option_value = unserialize( $result->option_value );
    $output = $option_value['content'];
    打赏 评论
  • douju5062 2013-04-25 21:00

    put the value in a variable and unserialize:

    $val = unserialize( $val );

    You'll get a PHP array as a result, inspect it with

    print_r( $val );
    打赏 评论

相关推荐 更多相似问题