preg_match 不能与结果一起使用正则表达式

问题描述 投票:0回答:0

不确定我做错了什么..

$url = "https://www.youtube.com/watch?v=5vXiaaIxPHs";
$contents = file_get_contents($url);
$contents = preg_replace("/\\r|\\n/", " ", trim($contents));

preg_match('#ytInitialData"\](\[\\s\\S\]\*?)window\["ytInitialPlayerResponse#', $contents, $matches);
var_dump($matches); //also tried print_r

preg match 找不到匹配项...... 有小费吗?坦克你这么多

上面试过 期待: 输出匹配

php preg-match
© www.soinside.com 2019 - 2024. All rights reserved.