更新时间:2023-10-23 19:00:40
没有PHP
vsJS
。客户端和服务器端都有。如果您需要将数据从一个PHP
脚本传递到另一个脚本,那么 Google是你的朋友 [ ^ ]。您也可以免费使用 Google 进行相关搜索(例如,从JS
和PHP
)。
There's noPHP
vsJS
. There are instead client side and server side. If you need to pass data from onePHP
script to another one then Google is you friend[^]. You are also free of using Google for related searches (e.g. apssing data fromJS
andPHP
).
在对问题的评论中进行讨论之后,我可以得出结论:问题仍然不太正确。替代什么? :-)
无论如何,让我提醒你注意一个非常普遍的新方法,因为它在服务器端独立交换数据,即使是你没有任何服务器。这是网络存储空间
: http://en.wikipedia.org / wiki / Web_storage 。
如果你想在同一个密钥,任意数据结构上传递更多数据,你也可以使用JSON
对象,用于序列化和反序列化数据。您可以在我的文章的这一部分找到一个全面但简短的代码: JavaScript Calculator, 7。动态严格模式切换和网络存储 。-SA
Following out discussion in the comment to the question, I can conclude: the question is still not quite correct. Alternative to what? :-)
Anyway, let me bring to your attention on newer approach which is very universal, because it exchanges data independent on your server side, and will work even if you don't have any server. This isWeb storage
: http://en.wikipedia.org/wiki/Web_storage.
If you want to pass more data at the same key, any arbitrary data structure, you can also useJSON
object, to serialize and deserialize data. You can find a comprehensive but short code in this section of my article: JavaScript Calculator, 7. Dynamic Strict Mode Switching and Web Storage.—SA