Home >Backend Development >PHP Tutorial >用JS如何调用当前已登陆用户名id?

用JS如何调用当前已登陆用户名id?

WBOY
WBOYOriginal
2016-06-20 12:35:561437browse

各位大神?如何用JS如何调用当前已登陆用户名id?谢谢各位大神!


回复讨论(解决方案)

你得在 php 中将 用户名id 传递过去

php后台传过去,前端页面写个隐藏的input,值就是ID,获取这个input的值就行了

你可以开启session储存id然后调用就行了,

参数传值,或者将用户名ID放在某个元素里面去查询获取

创建一个单文件  js.php

代码

echo “var userid=" .  session('id');
?>
然后再网站js调用前面加上
    <script></script>
不就得了

果然比较复杂。谢谢各位大神!

不能都给分了,各位大神见谅。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn