57 lines
2.1 KiB
PHP
57 lines
2.1 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>App图标搜索器</title>
|
|
<meta name="description" content="一款可以在线搜索APP图标并下载小工具">
|
|
<meta name="keywords" content="photo8,App图标搜索器">
|
|
<link rel="shortcut icon" href="https://api.photo8.site/path/img/icon-64@3x.png" type="image/png">
|
|
<link rel="stylesheet" href="css/styles.css">
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>搜索应用图标</h1>
|
|
<form method="GET" action="">
|
|
<input type="text" name="term" placeholder="输入APP名字">
|
|
<button type="submit">搜索</button>
|
|
</form>
|
|
<div class="icon-grid">
|
|
<?php
|
|
function fetchAppData($term, $limit, $offset) {
|
|
$url = "https://itunes.apple.com/search?term=" . urlencode($term) . "&country=CN&entity=software&limit=" . $limit . "&offset=" . $offset;
|
|
$json = file_get_contents($url);
|
|
$data = json_decode($json, true);
|
|
return $data['results'];
|
|
}
|
|
|
|
$searchTerm = isset($_GET['term']) ? $_GET['term'] : '';
|
|
if ($searchTerm) {
|
|
$apps = fetchAppData($searchTerm, 100, 0);
|
|
if (!empty($apps)) {
|
|
foreach ($apps as $app) {
|
|
echo '<div><img src="' . $app['artworkUrl100'] . '" alt="' . $app['trackName'] . '"><p>' . $app['trackName'] . '</p></div>';
|
|
}
|
|
} else {
|
|
echo "<p>没有这个应用.</p>";
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
<!-- 页脚显示逻辑 -->
|
|
<?php if ($searchTerm): ?>
|
|
<footer>
|
|
<div class="footer-content">
|
|
<p>关于</p>
|
|
<ul>
|
|
<li><a>Copyright © 2024 PHOTO8 </a></li>
|
|
</ul>
|
|
</div>
|
|
</footer>
|
|
<?php endif; ?>
|
|
|
|
<script src="js/scripts.js"></script>
|
|
<button id="back-to-top" title="Back to Top">↑</button>
|
|
</body>
|
|
</html>
|