为了将文件上传到谷歌云存储桶,我使用的是 JSON API。为此,我使用以下命令创建了一个 Bearer Token
$> gcloud auth activate-service-account myaccount@gserviceaccounts.co --key-file=creds.json
$> gcloud auth print-access-token
Run Code Online (Sandbox Code Playgroud)
现在我得到了一个令牌。我想知道,它是一个终生令牌,或者它有一些到期日。
我有下面的js代码
<script type="text/javascript">
var jvalue = 'Hi, $name';
</script>
Run Code Online (Sandbox Code Playgroud)
这是我的PHP代码
<?php
$name= "Rama";
$abc = "<script>document.write(jvalue)</script>";
echo $abc;
?>
Run Code Online (Sandbox Code Playgroud)
这给我输出
Hi, $name
Run Code Online (Sandbox Code Playgroud)
代替
Hi, Rama
Run Code Online (Sandbox Code Playgroud) 我有一个登录页面.我输入用户名和密码,并通过ajax提交我的页面.
在check.php中,验证了index.php中的值.
我尝试在check.php中设置一个SESSION ['email']变量,但在成功登录该站点后无法在HOME.php中访问它.
<?php
session_start();
?>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
function output(x) {
x=x.trim();
if(x=="YES") {
$(location).attr("href","HOME.php");
} else {
alert("login failed");
}
}
$(function() {
$(".submit").click(function() {
var Username = $("#txtUserName").val();
var Password = $("#txtPssword").val();
var dataString = 'Username='+ Username+'&Password='+Password;
$.ajax({
type: "POST",
url: "Check.php",
data: dataString,
success: function(response){
output(response);
}
});
return false;
});
});
</script>
</head>
<body>
<form method="post" name="login" id="form">
Username <input type="email" id ="txtUserName" />
Password <input type="password" id="txtPssword" />
<button type="submit" …Run Code Online (Sandbox Code Playgroud)