我被一个刚刚得到帮助的问题困住了——这是一个新问题,但只是轻微的问题。
我有这个 preg_match 来获取 href 的内容。请不要告诉我不要使用正则表达式 - 我知道使用其他解析器/类等,但这是一个旧脚本,现在只需要修复。:) 没有时间重写!
preg_match("~<a target=\'_blank\' rel=\'nofollow\' href=\"(.*?)\">~i", $epilink, $epiurl);
它返回:
http://www.example.com/frame2.php?view=&epi=54673-r
但是,它应该返回:
http://www.example.com/frame2.php?view=168204&epi=54673
这是一个可以使用的 html 示例:
<a target='_blank' rel='nofollow' href="http://www.example.com/frame2.php?view=545903&epi=54683">
为什么我返回的 URL 格式不正确?
感谢大家的帮助。