当使用像 $_SERVER 这样的 PHP 变量时,代码片段似乎会忽略 $。例如
{
// Example:
"IP Address Test": {
"scope": "php",
"prefix": "iptest",
"body": [
"// Debugging",
"if($_SERVER[\"REMOTE_ADDR\"]=='${1:ipaddress}'){",
"\t//run only my ip",
"\t$0",
"}"
],
"description": "Test only from IP address"
}
Run Code Online (Sandbox Code Playgroud)
}
输出:
// Debugging
if(_SERVER["REMOTE_ADDR"]=='xxx.xxx.xxx.xxx'){
//run only my ip
}
Run Code Online (Sandbox Code Playgroud) 我已经构建了一个以以下内容开头的javascript文件:
var myApp = function () {
var CLIENT_ID = 'xxxxxxx';
var DISCOVERY_DOCS = ["https://www.googleapis.com/discovery/v1/apis/gmail/v1/rest"];
var SCOPES = 'https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/analytics.readonly https://www.googleapis.com/auth/drive.readonly';
var authorizeButton = document.getElementById('authorize-button');
return {
Run Code Online (Sandbox Code Playgroud)
这些函数声明如下:
getSent: function(callback) {
var request = gapi.client.gmail.users.messages.list({
'userId': 'me',
'labelIds': 'SENT',
'maxResults': 10
});
request.execute(function(response) {
$.each(response.messages, function() {
var messageRequest = gapi.client.gmail.users.messages.get({
'userId': 'me',
'id': this.id
});
messageRequest.execute(myApp.appendMessageRow);
});
});
},
Run Code Online (Sandbox Code Playgroud)
然后运行一个调用其他函数的函数:
myApp.init();
Run Code Online (Sandbox Code Playgroud)
在谷歌请求函数getsent()完全完成后,如何推迟运行函数.我已经尝试将回调用于另一个函数并且它运行但是当getsent()仍在执行时它会运行.完成后我可以使用jQuery方法来运行回调吗?
我试过了:myApp.getSent(myApp.gMailSyncComplete()); //尽早运行
我尝试过:myApp.getSent().done(myApp.gMailSyncComplete()); //没有定义jQuery