我们可以将javascript变量发送为服务器端变量吗? [英] can we send javascript variables to as server side variable?

查看:72
本文介绍了我们可以将javascript变量发送为服务器端变量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我们可以将javascript变量发送为服务器端变量吗?
我有JavaScript变量,我想作为php会话值发送,
like(


can we send javascript variables to as server side variable
i have JavaScript variable i want to send as php session value ,
like(

var name="first name";


我想将此名称发送给


i want to send this name to

$_session['name']=name;


)
有可能吗?
如果可能的话,情况如何?
谢谢u


)
is it possible ?
if possible how it is?
Thank u

推荐答案

_session [' 名称' span>] = name;
_session['name']=name;


)
有可能吗?
如果可能的话,情况如何?
谢谢您


)
is it possible ?
if possible how it is?
Thank u


我不记得使用会话的详细信息,或更确切地说,它们的寿命和可见性是什么.

但这可以非常简单地通过ajax调用和php文件来实现.我想到的是这样的东西(为简单起见删除了错误检查):
setSessionVar.php
I can''t remember the finer details of using sessions, or more specifily what their lifespan and visibility is.

But this could very simply be achieved with an ajax call and a php file. What I have in mind is something this (with error checking removed for simplicity):
setSessionVar.php
<?php
    


varName =
varName =


这篇关于我们可以将javascript变量发送为服务器端变量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆