18 行
466 B
PHP
18 行
466 B
PHP
<?php
|
||
// パラメートルがなければ、スキップ。
|
||
if (null !== $_GET['url'] && $_GET['url'] != '') {
|
||
$data = file_get_contents('links.json');
|
||
|
||
foreach (json_decode($data) as $k => $v) {
|
||
// jsonファイルでキーを見つければ、転送されます。なければ、404エラーが出ます。
|
||
if ($_GET['url'] == $k) {
|
||
header('Location: '.$v);
|
||
exit;
|
||
}
|
||
}
|
||
}
|
||
|
||
include('404.html');
|
||
exit;
|
||
?>
|