【问题标题】:How do I remove this tag from twitter message-id 'tag:search.twitter.com,2005:7550668919283712'如何从 twitter message-id 'tag:search.twitter.com,2005:7550668919283712' 中删除此标签
【发布时间】:2010-11-27 11:27:37
【问题描述】:

当我将任何推文的 id (如“tweet->id”)存储到表中时,它还会存储来自推特的标签。 id 存储为

tag:search.twitter.com,2005:7550668919283712

我只需要存储 id 即 2005:7550668919283712。如何从存储到表中删除此标签。

【问题讨论】:

    标签: php mysql twitter message


    【解决方案1】:

    很简单,

    str_replace('tag:search.twitter.com,', '', 
      'tag:search.twitter.com,2005:7550668919283712');
    

    如果tag:search.twitter.com, 始终保持不变

    或者使用性能优于preg_split的explode

    【讨论】:

      【解决方案2】:

      http://ideone.com/xC8tw

      $arr = preg_split("/,/", "tag:search.twitter.com,2005:7550668919283712");
      $str = $arr[1];
      

      【讨论】:

        猜你喜欢
        • 2012-02-27
        • 2021-03-17
        • 2013-03-19
        • 1970-01-01
        • 2014-10-10
        • 2020-07-11
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多