我正在尝试使用新的图形API检索数据,但是我从OAuth中恢复的令牌似乎没有起作用.
我正在做的电话如下;
$token = file_get_contents('https://graph.facebook.com/oauth/access_token?type=client_cred&client_id=<app_id>&client_secret=<app secret>');
Run Code Online (Sandbox Code Playgroud)
这将返回一个字符串长度为41的标记.为了给出一个示例,我在下面提供了一个示例(将所有数字转换为0,将所有大写字母转换为'A',将小写字母转换为'a'
access_token=000000000000|AaaAaaAaaAAaAaaaaAaaAa0aaAA.
Run Code Online (Sandbox Code Playgroud)
我使用此访问令牌并将其附加到数据的调用请求,它似乎不是正确的令牌,因为它什么都不返回.我按如下方式进行数据调用;
file_get_contents('https://graph.facebook.com/<my_page's_id>/statuses?access_token=000000000000|AaaAaaAaaAAaAaaaaAaaAa0aaAA.')
Run Code Online (Sandbox Code Playgroud)
当我直接通过浏览器手动检索此页面时,我收到500 /内部服务器错误消息.
任何帮助都将得到很好的赞赏.
更新:
我已经将方法从file_get_contents()更改为curl.通过检索标题我得到以下错误消息...
{"error":{"type":"OAuthException","message":"Missing client_id"}}
Run Code Online (Sandbox Code Playgroud)
但我的帖子数组包括'client_id'?!
在PHP中,我使用curl将删除发送到fb图形api - 然而我收到以下错误;
{"error":{"type":"GraphMethodException","message":"Unsupported delete request."}}
Run Code Online (Sandbox Code Playgroud)
我正在使用的代码是;
$ch = curl_init("https://graph.facebook.com/" . $status_id . "");
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_CAINFO, NULL);
curl_setopt($ch, CURLOPT_CAPATH, NULL);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
$result = curl_exec($ch);
echo $result;
Run Code Online (Sandbox Code Playgroud)
$ query包含访问令牌.
我有一个包含表单的分区(<div>),如果任何<input>有焦点,我想找出使用jQuery,如果没有,我想要调用一个函数.
这样做的最佳方式是什么?
div/form结构的粗略概念.
<div id="section1">
<form ...>
<input type="text" id="v1">
<input type="text" id="v2">
<input type="text" id="v3">
<input type="text" id="v4">
<input type="checkbox">
</form>
</div>
Run Code Online (Sandbox Code Playgroud)
谢谢.
我有一个问题,我在Lumen的配置中设置时区到欧洲/伦敦.这一直工作得非常好,直到最近更改为DST,它正在设置正确的created_at和updated_at日期,但是当我调用记录时,它显示的日期时间好像是UTC而不是BST/DST.
在我的config/app.php文件中,我有;
...
timezone' => 'Europe/London',
...
Run Code Online (Sandbox Code Playgroud)
在我的检查路线中,我有;
$app->get('mytime', function() {
$now = Carbon\Carbon::now();
dd($now, date('Y-m-d H:i:s'));
});
Run Code Online (Sandbox Code Playgroud)
返回
Carbon {#35 ?
+"date": "2016-04-14 10:33:15.000000"
+"timezone_type": 3
+"timezone": "Europe/London"
}
Run Code Online (Sandbox Code Playgroud)
然而,当我拉出一条记录表示创建日期为"2016-04-14 10:00:00"时,它会返回'2016-04-14 09:00:00'.
我们将非常感谢您对此时区问题的任何帮助.
我是vue的新手,并且已经在http://vuejs.org/examples/select2.html上关注了他们的"自定义指令" .
仅在选择一个项目时效果很好,但是当您选择多个项目时,它只会通过第一个项目.我需要它来传递所有选定的值.
我有一个jsfiddle设置显示这里可用的代码. https://jsfiddle.net/f3kd6f14/1/
该指令如下;
Vue.directive('select', {
twoWay: true,
priority: 1000,
params: ['options'],
bind: function() {
var self = this
$(this.el)
.select2({
data: this.params.options
})
.on('change', function() {
self.set(this.value)
})
},
update: function(value) {
$(this.el).val(value).trigger('change')
},
unbind: function() {
$(this.el).off().select2('destroy')
}
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激.
我正在MySQL中创建一个存储过程,并且在使用IF EXISTS时遇到问题
我的SQL是;
CREATE DEFINER=`##`@`%` PROCEDURE `myTestProceedure`(IN _id INT)
BEGIN
IF EXISTS (SELECT * FROM cms.variables WHERE tmplvarid = 5 and id = _id) THEN
BEGIN
UPDATE cms.variables SET value = now() WHERE id = _id and tmplvarid = 5;
END;
ELSE
BEGIN
INSERT INTO cms.variables (`tmplvarid`, `contentid`, `value`) VALUES (5, _id, now());
END;
END IF;
END
Run Code Online (Sandbox Code Playgroud)
基本上,我在这个过程中尝试做的是如果该行已经存在于DB中,请更新它,否则插入它.
然而,尽管有任何结果SELECT * FROM cms.variables WHERE tmplvarid = 5 and id = _id,它只是插入数据库.
任何帮助将不胜感激.
我正在学习swift,我正在尝试创建一个函数,它将根据按下的按钮更新故事.我已经设置了按钮按下位,但是我将按下的按钮的标签传递给该updateStory功能.
func updateStory(myTag: Int) {
let next = [
1 : [
1 : 3,
2 : 2,
],
2 : [
1 : 3,
2 : 4,
],
3 : [
1 : 6,
2 : 5,
]
]
// Error:(86, 17) value of optional type '[Int : Int]?' not unwrapped; did you mean to use '!' or '?'?
if (next[storyIndex][myTag] != nil) {
let nextStory = next[storyIndex][myTag]
storyIndex = nextStory
}
}
Run Code Online (Sandbox Code Playgroud)
StoryIndex被定义为类中的全局变量.
任何指针都将非常感激.