I'm using the same datastore (a simple key-value store) on the server and inside the browser which hold all my model-data.
我在服务器上和浏览器中使用相同的数据存储区(一个简单的键值存储区)来保存我的所有模型数据。
I'd like to synchronise them. Therefore I'd have to write a server-adapter and a client-adapter. I'm interested whether there's an approach which doesn't require me to write two separate components.
我想同步它们。因此,我必须编写服务器适配器和客户端适配器。我很感兴趣是否有一种方法不需要我编写两个单独的组件。
1 个解决方案
#1
0
It is possible but highly not recommended to do using only javascript. This would require ADODB.Connection activeXObject. This is highly insecure as you must give the browser access to the SQL passwords. The preffered way to do this would be to use either a javascript httprequest call or AJAX call to a php script. Once again highly discourage the use of ADODB objects in client side scripts.
有可能,但强烈建议不要只使用javascript。这将需要ADODB.Connection activeXObject。这是非常不安全的,因为您必须让浏览器访问SQL密码。执行此操作的优先方法是使用javascript httprequest调用或对php脚本的AJAX调用。再一次强烈反对在客户端脚本中使用ADODB对象。
Given that this is a 2 node sync as in only one client will be working and editing the data set at any given point in time the PHP will simply be getting values from the client and storing them and fetching values from the server and printing them. Very simple script.
鉴于这是一个2节点同步,因为只有一个客户端将在任何给定的时间点工作和编辑数据集,PHP将只是从客户端获取值并存储它们并从服务器获取值并打印它们。非常简单的脚本。
#1
0
It is possible but highly not recommended to do using only javascript. This would require ADODB.Connection activeXObject. This is highly insecure as you must give the browser access to the SQL passwords. The preffered way to do this would be to use either a javascript httprequest call or AJAX call to a php script. Once again highly discourage the use of ADODB objects in client side scripts.
有可能,但强烈建议不要只使用javascript。这将需要ADODB.Connection activeXObject。这是非常不安全的,因为您必须让浏览器访问SQL密码。执行此操作的优先方法是使用javascript httprequest调用或对php脚本的AJAX调用。再一次强烈反对在客户端脚本中使用ADODB对象。
Given that this is a 2 node sync as in only one client will be working and editing the data set at any given point in time the PHP will simply be getting values from the client and storing them and fetching values from the server and printing them. Very simple script.
鉴于这是一个2节点同步,因为只有一个客户端将在任何给定的时间点工作和编辑数据集,PHP将只是从客户端获取值并存储它们并从服务器获取值并打印它们。非常简单的脚本。