[00:01.71]Listen to part of a conversation between a student and his professor.
[00:16.14]Student : Hmmm, yes. I go over the Johnson Elementary School
[00:31.96]I mean it's like the best thing ever to prepare you to be a good teacher.
[00:55.72]the way we've been talking about in class.
[01:12.39]but they didn't know that the names had any meaning -
[02:45.59]Student : Ok, that sounds all right.
这个一个歌词文件的一段,中括号包起来的是歌词开始的时间,我该以什么格式把歌词的开始时间传到前端手里
比如:
{[00:01.71],[00:16.14],[00:31.96]}这样的格式合适吗?
前端如何把这些数据转化成["01.71","16.14","31.96","72.39","165.59"]
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这个格式这么简单,怎么传都行,只要跟前端商量好。就算直接传字符串前端也就是一个简单的正则表达式就能解决的问题。
感觉你的意思应该是你想传递的是下面这样的格式吧,不然的话你用中括号完全没有必要
{"[00:01.71]","[00:16.14]","[00:31.96]"}
其实你应该把这样的数据格式化后传递给前端,因为你本来就要处理这段数据,就在多做一步不是省去前端再处理一次的麻烦吗,直接传下面的格式,我想前端会很开心的
{"01.71","16.14","31.96"}
传的时候以毫秒格式,前端有Date.parse()。
{[00:01.71],[00:16.14],[00:31.96]}也可以,直接以字符串方式展示。