36 lines
841 B
PHP
36 lines
841 B
PHP
|
|
<?php
|
||
|
|
/**
|
||
|
|
* 回归:f_check nt.txt 畸形行跳过 + fp 索引合法
|
||
|
|
*/
|
||
|
|
$config_name = 'index';
|
||
|
|
$all_fp_url = ['https://example.com/fp1'];
|
||
|
|
$num = count($all_fp_url);
|
||
|
|
$now_url = 0;
|
||
|
|
$lines = ["index\n", "index||||||2\n"];
|
||
|
|
|
||
|
|
foreach ($lines as $buffer) {
|
||
|
|
$bb = explode('||||||', $buffer);
|
||
|
|
if (trim($bb[0] ?? '') !== $config_name) {
|
||
|
|
continue;
|
||
|
|
}
|
||
|
|
if (!isset($bb[1]) || trim($bb[1]) === '') {
|
||
|
|
continue;
|
||
|
|
}
|
||
|
|
$now_url = max(1, (int) trim($bb[1]));
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (!$now_url) {
|
||
|
|
$now_url = 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
$idx = max(0, min(max(1, (int) $now_url) - 1, $num - 1));
|
||
|
|
$fp_url = $all_fp_url[$idx];
|
||
|
|
|
||
|
|
echo json_encode([
|
||
|
|
'ok' => $fp_url === 'https://example.com/fp1' && $idx === 0,
|
||
|
|
'fp_url' => $fp_url,
|
||
|
|
'idx' => $idx,
|
||
|
|
'now_url' => $now_url,
|
||
|
|
], JSON_UNESCAPED_UNICODE) . "\n";
|