如何在表达式引擎 2 中生成唯一 ID?
是否有可生成唯一 ID 的 EE2 标签?或者我是否需要嵌入 PHP uniqid() 调用来获取所需的唯一 ID?谢谢。
Is there an EE2 tag that produces a unique ID? Or would I need to embed a PHP uniqid() call to get the desired unique ID? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,没有 EE 标签可以做到这一点。它需要您创建自己的插件、扩展或模块。但这很简单。
我的建议是创建一个插件。
在
expressionengine/third_party
文件夹中创建一个名为guid
的文件夹。在该文件夹中,创建一个名为 pi.guid.php 的文件,其中包含以下内容:
好了,您自己的插件可以通过标签创建 uniqid()。
用途?
太棒了,对吧?
我爱EE...
No, there is not a EE tag that does that. It would require that you created your own plugin, extension or module. But that pretty simple.
My suggestion is to create a plugin.
Create a folder named
guid
in yourexpressionengine/third_party
folder.In that folder, create a file called pi.guid.php with the following content:
There you go, your very own plugin to create uniqid() through tags.
The use?
Awesome, right?
I love EE...
没有内置的EE标签来输出唯一的ID,没有。
There is no built-in EE tag to output a unique ID, no.