在 html 上保存短数组最有效、最安全的方法是什么?
我正在尝试创建一个网站作为绘图程序和用户输入文件之间的接口。绘图程序需要几个参数,我可以允许用户使用输入标签输入这些参数。但是绘图程序还需要用户在图例上输入以区分输入文件中的值,即值的范围(边界)以及该范围对应的颜色。我创建了一个字段集,其中包含一个范围所需的输入元素。当用户单击“添加另一个范围”时,字段集的内容将被清除,以便为新的输入做好准备。之前输入的内容将作为新行存储在下表中。在这一行旁边,有一个“删除”按钮。
由于本网站面向多个用户,因此该信息也应对相应的用户是专有的。有人可以告诉我应该使用什么方法吗?绘图程序是用 perl 编写的,我在这个网站上使用 CGI。 这种方法应该允许 html 部分访问数组中的当前值,这样我就可以动态显示表中输入的范围。该方法还应该允许删除/修改/添加此类输入的范围信息。我正在考虑一个临时数据库。但我只需要字符串中所有范围信息的最终版本,因此我可以将其发送到 CGI 程序并将其组织为要输入到 perl 绘图程序中的正确格式。
非常感谢任何帮助或提示!我是这个领域的新手。非常感谢您提前抽出时间并提供帮助!
I'm trying to make a website to serve as the interface between a plotting program and the user input file. The plotting program needs several parameters, which I could allow the user to enter using input tag. But the plotting program needs user input on the legend for distinguishing the values in the input file as well, namely the range(boundary) of value and the corresponding color for this range. I made a fieldset containing the required input elements for one range. When user click "Add another range", the content of the fieldset is cleared so as to be ready for the new input. And the previously entered input is stored in a table below as a new row. Beside this row, there is a "delete" button.
As this website is aimed for multiple users, this information should be also exclusive for the corresponding user. Could someone please tell me what approach should I use? The plotting program is written using perl, and I'm using CGI for this website.
And this approach should allow the html part to access the current values in the array, so I could display the entered ranges in the table dynamically. This approach should also allow the deletion/modification/addition of such entered range information. i'm thinking of a temporary database. But I only need the final version of all the range info in a string, so I can send it to the CGI program and organize it to be the correct format to be inputted into the perl plotting program.
Any help or hint is greatly appreciated! I'm a newbie to this area. Thank you very much for your time and help in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如今,JSON 已经非常通用了。用那个。许多新的数据库系统(例如 MongoDB)使用 JSON 作为本机存储格式。
大多数服务器端语言都可以轻松使用和生成 JSON。 JSON 允许结构化数据,因此它比简单数组能做更多的事情。
JSON 作为原生 JavaScript 对象,在浏览器上的速度也非常快(与 XML 相比)。
JSON is pretty universal these days. Use that. Many new database systems like MongoDB use JSON as a native storage format.
Most server-side languages can consume and produce JSON easily. JSON allows structured data, so it can do more than simple arrays.
JSON is also very fast on the browser (compared to XML), being a native JavaScript object.
如果数据纯粹是 Perl 格式,那么可以使用 FreezeThaw 或 Storable。如果你的数据很简单,那么 Diodeus 使用 JSON 的答案没有任何问题,但随着事情变得复杂,这些模块将能够更好地处理 Perl 数据结构的复杂性。
If the data will be purely in Perl, then FreezeThaw or Storable are the things to use. If your data is simple, then there is nothing wrong with Diodeus' answer of using JSON, but as things get complicated, those modules will be able to handle the complexities of Perl datastructures better.