我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

将字符串转换回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?

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.

近期文章

  • 简单? 逻辑缺陷与我的功能
  • 如何在php中生成查询错误
  • 数组值和索引迁移
  • 错误致命错误:使用OAuth时未找到类“Oauth”
  • 创建PHP多维关联数组的Javascript版本
  • 我应该使用哪些技术来提供开箱即用的服务器安装[关闭]
  • PHP - 访问SimpleXML :: xpath函数数组的第一个索引
  • 在php中访问textarea内容时的特殊字符
  • 如何显示数据ID,名称?
  • 如何知道本地URI / URL是否存在?
  • 如何通过PHP脚本推送的JSONencoded字符串在Android站点中检索JSON数组数据?
  • 我怎么能用php http://elcinema.tv/system/videos/{this id} /sd.flv知道id
  • 如果带有CI的单选按钮的语句
  • 单元测试,测试之间的耦合和级联故障
  • 使用PHP解析XML链接
  • 事后得到唯一的身份证?
  • 寻找CSS和js文件合并和最小化[关闭]
  • 向PHP表单添加更多字段(用户可以添加多个地址)
  • 将字符串分隔成数组?
  • .htaccess网址安全

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华