问题描述
我已经暗示 Google 登录到我的网站已成功,并且只要它们都在同一页面上,注销工作正常。
我在网站上有一个导航栏,它包含在每个页面(包括登录页面)的顶部,我想在导航栏上找到退出按钮,但是当我这样做时,它不再起作用。
由于我使用的是 PHP,因此我尝试在登录和注销按钮所在的位置设置 header('location:login.PHP');
,然后使用
<script src="'.$js.'script.js"></script> // this is my js script where the signOut() function is declared <script type="text/javascript"> window.onload = signOut; </script>
它没有用,
我还尝试在用户使用 PHP 标点 document.getElementById("google_signout").click;
发送到那里后使用 header('location:login.PHP');
触发退出按钮,但它也不起作用。
正确的做法是什么?
顺便说一句,我在 PHP 代码中编写 Javascript 代码,就像这样:
<?PHP
if (isset($_SESSION['User'])){ // run this if the user is logged in
echo '<script src="'.$js.'script.js"></script> //load my script where the google signOut() is declared
<script type="text/javascript">
window.onload = signOut;
</script>';
}else{
//do something else
}
?>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)