我的 html 看起来像这样(它的 javascript 用于 Flash 播放器):
var flashvars =
{
'autoplay' : autoplay,
'autoreplay' : 'false',
'start' : '',
'hideLinkPane' : 'true',
'disable_sharebar' : 'true',
'disablePauseroll' : disablePauseroll,
'video_url' : encodeURIComponent('WQFuk9Py2VC3jsCrPDJ69xtsj33MiXAElBzQw3TSHqOOyDYL0vRJELrB1hTTW3NG0A54kE2FVueuHMkQd8JveYb92eV+dYH4IUrrvJdP5Of9HGi+5i6GT11nL0dAv/ecyP4sB0jM8rVZzyS8imLarvPUvPuFPvvB8nwYXZ2ZKon4IPjmtC8SPftaw0PSuZKMg735hLCraeAE3lMQbRwiY7yMHKmUHDALG1Ky+HBDiK20vAGEIMwzPwKZmhbBXRGiHzEiXiRk4JgaVyp6N66EALao7VOE7UTzJLs='),
'encrypted' : 'true',
'video_title' : "some cool vids title here",
'embed_js' : "",
'prerollRepeat' : "false"
};
如何使用 preg_match 提取 video_title 的值,使其变为:
回声 $videoTitle;
将输出:一些很酷的视频标题在这里
对于 video_url 将输出:
WQFuk9Py2VC3jsCrPDJ69xtsj33MiXAElBzQw3TSHqOOyDYL0vRJELrB1hTTW3NG0A54kE2FVueuHMkQd8JveYb92eV + dYH4IUrrvJdP5Of9HGi + 5i6GT11nL0dAv / ecyP4sB0jM8rVZzyS8imLarvPUvPuFPvvB8nwYXZ2ZKon4IPjmtC8SPftaw0PSuZKMg735hLCraeAE3lMQbRwiY7yMHKmUHDALG1Ky + HBDiK20vAGEIMwzPwKZmhbBXRGiHzEiXiRk4JgaVyp6N66EALao7VOE7UTzJLs =
我的 php 看起来像这样:
$pagex = $this->page;
$patternx = '/("video_title":")(.*?)(")/i';
if(preg_match($patternx,$pagex,$arx)){
$key = $arx[2];
}
$page = $this->page;
$pattern = '/("video_url":")(.*?)(")/i';
if(preg_match($pattern,$page,$ar)){
$link = $ar[2];
}
它不起作用。它什么也没显示。