Coldfusion:时间戳的奇数输出:替换为 x

发布于 2025-01-09 11:27:10 字数 709 浏览 1 评论 0原文

我认为我的时间戳需要位于字符串的末尾。但是当我把它移到那里时 - 我得到了 &times 的奇怪输出变成了 x。有解决办法吗?在前面它工作得很好。

<cfset usem = "timestamp=#unixdatetimeNow.getTime()#&symbol=#pair#&side=#side#&type=#type#&quantity=#size#">

输出:

timestamp=1645552579468&a​​mp;symbol=SHIBUSDT&side=sell&type=market&quantity=9005

<cfset usem = "symbol=#pair#&side=#side#&type=#type#&quantity=#size#&timestamp=#unixdatetimeNow.getTime()#">

输出带有 x :

symbol=SHIBUSDT&side=sell&type=market&quantity=9005×tamp=1645552579468

如何修复此 x 替换?在 cfset 和脚本中都执行此操作

I think my timestamp needs to be at the end of the string. But when I move it there - I get an odd output of the × turns into an x. Is there a fix for this? At the front it works fine.

<cfset usem = "timestamp=#unixdatetimeNow.getTime()#&symbol=#pair#&side=#side#&type=#type#&quantity=#size#">

Outputs :

timestamp=1645552579468&symbol=SHIBUSDT&side=sell&type=market&quantity=9005

<cfset usem = "symbol=#pair#&side=#side#&type=#type#&quantity=#size#×tamp=#unixdatetimeNow.getTime()#">

Outputs with the x :

symbol=SHIBUSDT&side=sell&type=market&quantity=9005×tamp=1645552579468

How do I fix this x replacement? Does it in both cfset and in script

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

卷耳 2025-01-16 11:27:10

更新:2022-04-06

TLDR底线是,无需执行任何操作。正如评论中提到的,以及您的其他线程ColdFusion:Binance API : 并没有读取所有发送的参数,参数名称仍然是×tamp,只是看起来 xtamp 当显示在屏幕上时。


这是因为子字符串 × 被视为 html实体 ×,它被渲染为符号x

为什么[时间戳]前面可以,后面不行?

timestamp 是查询字符串中的第一个参数时,“time”前面没有 &。所以它不被视为 html 实体。

请记住,这只是一个演示问题。当您输出变量时,子字符串&time仅呈现为x。变量的实际内容不会改变。所以在你的 cfhttp 调用中使用它没有任何反应:

 // sends "×tamp" not "xstamp"
 cfhttp(....) {
    ...
    cfhttpparam(type="body", value="#yourString#");
 }

修复:&

可能会显示在屏幕上正确显示,但会中断您的 cfhttp 调用,因为它将参数名称设置为文字字符串 ×tamp 但 API 需要名为 timestamp 的参数。

Update: 2022-04-06

TLDR; Bottom line, nothing needs to be done. As mentioned in the comments, and your other thread ColdFusion : Binance API : Not all sent parameters were read, the parameter name is still ×tamp, it just appears to be xtamp when displayed on screen.


It's because the substring × is being treated as the html entity ×, which gets rendered as the symbol x.

Why is [timestamp] fine at the front but not back?

When timestamp is the first parameter in the query string, there's no & preceding "time". So it's not treated as an html entity.

Keep in mind this is just a presentation issue. The substring &time is only rendered as x when you output the variable. The actual contents of the variable don't change. So nothing happens its used in your cfhttp call:

 // sends "×tamp" not "xstamp"
 cfhttp(....) {
    ...
    cfhttpparam(type="body", value="#yourString#");
 }

Fixed with : & : <cfset usem = "...&timestamp=#unixdatetimeNow.getTime()#">

That might display correctly on screen, but will break your cfhttp call because it sets the parameter name to the literal string &timestamp but the API is expecting a parameter named timestamp.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文