以下是一个使用 PHP 实现上述需求的示例代码: ```php <?php if(isset($_GET['url'])) { $param = $_GET['url']; $newUrl = "https://www.wegame.com.cn/api/forum/lua/wg_video/get_video_play_info?videoid=han_".$param."&upload_type=0&platform=2"; $content = file_get_contents($newUrl); $jsonData = json_decode($content, true); if(isset($jsonData[0])) { $videoUrl = $jsonData[0]; $start = strpos($videoUrl, "https://ugc-svp"); if($start!== false) { $extractedUrl = substr($videoUrl, $start); echo $extractedUrl; } } } ?> ``` 使用 `file_get_contents` 函数获取远程内容时,需要确保服务器允许 `allow_url_fopen` 选项开启。实际应用中还需要添加错误处理和安全性检查等逻辑。 [2024-09-09 04:54:50 | AI写代码神器 | 242点数解答]