dscojuxf69080 2012-03-11 23:04
浏览 447
已采纳

将字符串转换回ObjectID

I have converted a ObjectID to string which acts as a dropdown list value. When posted I need to take this string and convert it back to a ObjectID in the cleanest fashion.

What would be the best way of doing this?

  • 写回答

1条回答 默认 最新

  • dongren5293 2012-03-11 23:12
    关注

    It seems that MongoID class accepts a string in the constructor:

    public MongoId::__construct ([ string $id = NULL ] )
    

    id

    A string to use as the id. Must be 24 hexidecimal characters. If an invalid string is passed to this constructor, the constructor will ignore it and create a new id value.

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

报告相同问题?

悬赏问题

  • ¥15 两块ADC0804用proteus仿真时,出现异常
  • ¥15 关于风控系统,如何去选择
  • ¥15 这款软件是什么?需要能满足我的需求
  • ¥15 SpringSecurityOauth2登陆前后request不一致
  • ¥15 禅道二次开发编辑版本,上传不了发行包
  • ¥30 arcgis处理夜间灯光数据,使用投影栅格使图像变暗
  • ¥15 荔枝派Zero开发板登陆后怎么自动执行可执行文件
  • ¥15 复现:how to backdoor federated learning
  • ¥15 vue进度条切换,带有背景边框
  • ¥15 安防监控网络故障问题