📌  相关文章
📜  file_get_contents 跟随重定向 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:35.756000             🧑  作者: Mango

代码示例2
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$a = curl_exec($ch);
if(preg_match('#Location: (.*)#', $a, $r))
 $l = trim($r[1]);