Files

25 lines
910 B
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// 1. 定义你的 Docker Registry 地址
// 请将 'http://localhost:5000' 替换为你的实际 Registry 地址。
// 例如:如果你的 Registry 是 'my-registry.io',就改为 'https://my-registry.io'
$registryUrl = "https://regw.ww3.tw/";
// 2. 定义你要获取的 API 端点
// 这个端点用于获取所有仓库列表。
$endpoint = "/v2/_catalog";
// 3. 组合完整的 URL
$fullUrl = $registryUrl . $endpoint;
// 4. 使用 file_get_contents() 获取 JSON 内容
// @ 符号用来抑制可能出现的错误或警告,让输出更干净。
$jsonContent = @file_get_contents($fullUrl);
// 5. 直接输出 JSON 内容
// 如果成功获取到内容,就直接打印出来。
// 如果获取失败会打印一个空字符串或PHP的错误信息如果没用@抑制)。
header('Content-Type: application/json'); // 告诉浏览器这是一个JSON响应
echo $jsonContent;
?>