如何在PHP中获取JavaScript变量值
我想要使用PHP可以访问的JavaScript变量的值。我使用下面的代码,但它不返回PHP中该变量的值。
// set global variable in javascript
profile_viewer_uid = 1;
// php code
$profile_viewer_uid=$_POST['profile_viewer_uid'];
这给了我以下错误: -
A PHP Error was encountered
Severity: Notice
Message: Undefined index: profile_viewer_uid
我使用的另一个PHP代码给出空值
$profile_viewer_uid = "<script language=javascript>document.write(profile_viewer_uid);</script>
当我回声时它什么也没有显示。
繁花不似锦
桃花长相依