【发布时间】:2016-06-25 07:58:05
【问题描述】:
我是代码点火器的新手。在我的视图中,我添加了此代码以在我的网站中启用谷歌登录。
<html lang="en">
<head>
<meta name="google-signin-scope" content="profile email">
<meta name="google-signin-client_id" content="720765566138-5c6jreo4r7ma6cm0hdblj5cmjtdiruk4.apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js" async defer> </script>
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn" data-onfailure="onFailure" data-theme="dark"></div>
<script>
function onFailure(msg){ console.log(msg); }
function onSignIn(googleUser) {
console.log("onSignIn");
var profile = googleUser.getBasicProfile();
var user_name = profile.getName();
var id = googleUser.getAuthResponse().id;
};
</script>
</body>
</html>
如何将变量 user_name 和 id 发送到 Controller,以便我可以调用 Model 将值插入数据库。
【问题讨论】:
标签: javascript php database codeigniter