解析错误:语法错误,意外的“隐藏”(T_STRING)

时间:2019-10-30 12:19:59

标签: php preg-match

我有html行

<input type="hidden" name="64fe437df7ac92d258ecfc8b46970ffc" value="1" /></form>

我想使用preg_match获得此 64fe437df7ac92d258ecfc8b46970ffc

$url = "http://www.ugodambrosi.it/index.php?option=com_users&view=registration";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_exec($ch);
curl_close($ch);

preg_match("/<input type="hidden" name="(.*?)" value="1"/", $result, $matches);
print_r($matches);

但是为什么会这样

 Parse error: syntax error, unexpected 'hidden' (T_STRING) in on line 10

1 个答案:

答案 0 :(得分:0)

preg_match("/<input type='hidden' name='(.*?)' value='1'/", $result, $matches);

由于双引号,输入字段未关闭。您可以将其更改为单引号。