Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的数据库中有 fb_id 100001635692408但是当我在我的 PHP 脚本中得到它时,它会打印出类似1.0000163569241E+14的内容。我怎样才能在不转换的情况下得到那个数字?
将 fb_id 以字符串格式存储在数据库中。
你必须使用number_format().
number_format()
number_format($myNum, 0, "");
这将显示您的数字,不带逗号(第三个参数是分隔符)或小数(这是第二个参数的用途)。
您应该将 ID 存储为字符串,尤其是 Facebook id,它对于某些对象可以是字母数字。这些 ID 也可能比某些机器在某些时候可以存储为整数的 ID 更大,就像许多 Twitter 应用程序所发生的那样。
您也永远不会将此数据用作整数。您永远不会一起添加 ID,或者检查一个是否大于另一个。所以 int/number 真的是这里的错误类型。