Merge pull request #37 from banditsmile/bugfix/bandit/spell

拼写问题处理
pull/39/merge
Mr.zou 2019-03-15 11:51:15 +08:00 committed by GitHub
commit c98e68f172
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -44,10 +44,14 @@
}
//上面验证通过,继续执行
//取出tinypng key
$kyes = $row['values'];
$kyes = json_decode($kyes);
$i = 'api'.rand(1,2);
$key = $kyes->$i;
//拼写错误处理
$keys = $row['values'];
//可以使用任意多个key
//@todo 建议使用列表类型而不是联名数组类型保存key
$keys = json_decode($keys, true);
$i = 'api'.rand(1, count($keys));
$key = $keys[$i-1];
$url = "https://api.tinify.com/shrink";
$data = file_get_contents($path);