我在Guzzle 4.2上收到401,并且在Postman上也可以使用相同的设置。下面的代码。
// Create a client with a base URL
$client = new GuzzleHttp\Client(['base_url' => 'cloud.feedly.com/v3/streams/contents?streamId=user/user-id/category/global.all&count=1']);
// Send a request to https://github.com/notifications
$response = $client->get();
//Auth
$response->addHeader('Authorization', "auth-code");
//send
$r = $response->send();
dd($r->json());
Run Code Online (Sandbox Code Playgroud)
错误是:
GuzzleHttp \ Exception \ ClientException (401)
Client error response [url] cloud.feedly.com/v3/streams/contents?streamId=user/user-id/global.all&count=1 [status code] 401 [reason phrase] Unauthorized
Run Code Online (Sandbox Code Playgroud) I am trying to delay the execution of a script by a few seconds after it processes say 200 records using Laravel's chunk method. Here's what I've right now. Should I put a counter somewhere? But then that will not work I believe, are there other techniques?
Article::chunk(200, function ($articles)
{
foreach ($articles as $article)
{
}
});
Run Code Online (Sandbox Code Playgroud)
Thanks to WereWolf, it worked. Can't believe it was so simple.
[2014-08-27 07:18:23] local.INFO: Article metrics:198 [] []
[2014-08-27 07:18:24] local.INFO: Article …Run Code Online (Sandbox Code Playgroud) 为什么我会在返回的数据中得到差异.它工作正常,直到3,然后繁荣,它混乱到最后.我在做什么很简单.我从带有id,name的txt文件中获取值,并将id与另一个具有name,name的txt文件匹配,使其看起来像id,id,如下所示.但是,它并不像您期望的那样有效.匹配正在进行,直到它搞砸了.
0,1
1,3
0,2
0
3,0,4
2
3,0
4,2
4,1
2,
while ((output2 = br2.readLine()) != null) {
String[] vv = output2.split(",");
String value1 = vv[0];
String value2 = vv[1];
for (Map.Entry<Integer, String> entry : map.entrySet()) {
int key = entry.getKey();
String value = entry.getValue();
//System.out.println(key+","+value);
if ((value1.equals(value))) {
System.out.print(key + ",");
}
if ((value2.equals(value))) {
System.out.print(key + "\n");
}
}
}
Run Code Online (Sandbox Code Playgroud)
数据
ids.txt
0,Triple H
1,John Cena
2,Megan Fox
3,The Undertaker
4,Pamela Anderson
5,The Rock
Run Code Online (Sandbox Code Playgroud)
的text.txt
Triple H,John Cena …Run Code Online (Sandbox Code Playgroud) 我基本上只是想不出这个,不想破解它.
如果我这样做一年52周就会显得那么混乱.
有小费吗?
更新
这个问题与获得当年的本周无关.
这个问题是关于自定义日期以来已过去几周的问题.
我希望下周的训练能够在本周的第6天出现;)
例
我开始的日子是99:2018-05-30 18:39:29.
你的一些例子在第15周向我展示.
然而,我的代码显示了第16周,这是正确的.看到警告?
calculateUsersCurrentWorkoutWeek: function(timestamp) {
let daysSinceSignup = moment().diff(timestamp, "days");
if (daysSinceSignup <= 6) {
return 1;
} else if (daysSinceSignup > 6 && daysSinceSignup <= 13) {
return 2;
} else if (daysSinceSignup > 13 && daysSinceSignup <= 20) {
return 3;
} else if (daysSinceSignup > 20 && daysSinceSignup <= 27) {
return 4;
} else if (daysSinceSignup > 27 && daysSinceSignup <= 34) {
return 5;
} …Run Code Online (Sandbox Code Playgroud)