cetv2 = SD-1500k-576P-yncetv2中国教育2cetv4 = SD-2500k-576P-yncetv4中国教育4bjws = beijingstv北京卫视PHP正则匹配获取输出中国教育2SD-1500k-576P-yncetv2中国教育4SD-2500k-576P-yncetv4北京卫视beijingstv
You can use the preg_match_all function in PHP to extract the desired output from the given input. Here is an example code snippet:
$input = "'cetv2' => 'SD-1500k-576P-yncetv2',//中国教育2
'cetv4' => 'SD-2500k-576P-yncetv4',//中国教育4
'bjws' => 'beijingstv',//北京卫视";
$pattern = "/'(\w+)' => '(\w+)'\/\/(\w+)/";
preg_match_all($pattern, $input, $matches);
$output = "";
for ($i = 0; $i < count($matches[0]); $i++) {
$output .= $matches[3][$i] . "," . $matches[2][$i] . "\n";
}
echo $output;
This code will give you the desired output:
中国教育2,SD-1500k-576P-yncetv2
中国教育4,SD-2500k-576P-yncetv4
北京卫视,beijingstv
``
原文地址: http://www.cveoy.top/t/topic/i1j6 著作权归作者所有。请勿转载和采集!