<?php
header('Content-Type: application/json');
header('Content-Type: text/html;charset=utf-8');
header('Access-Control-Allow-Origin:*');
#$callback = $_GET["callback"];
#$data = array('a','b','c');
#echo $callback.'('.json_encode($data).')';
$ID = $_GET["key"];
if (strcasecmp("", $ID) != 0) {
$ID = $_GET["key"];
$file_path = "key.txt";
if (file_exists($file_path)) {
$file_arr = file($file_path);
$flag = FALSE;
for ($i = 0; $i < count($file_arr); $i++) {//逐行读取文件内容
#if(1 == strcmp($file_arr[$i], $ID)){
if (strcasecmp($file_arr[$i], $ID . "\n") == 0) {
$flag = TRUE;
}
}
}
if ($flag == FALSE) {
file_put_contents("key.txt", $ID . "\n", FILE_APPEND);
}
}
?>