这两个差异声明有什么不同?任何参考文件?
'{<table width="100%" border="0" cellspacing="0" cellpadding="0">.*?</table>}si' -> Success
'%<table width="100%" border="0" cellspacing="0" cellpadding="0">.*?</table>%si' -> Fail
Run Code Online (Sandbox Code Playgroud)
好吧,你正在使用在你的字符串中使用的分隔符(100%),如果你决定使用%作为分隔符,你需要使用反斜杠转义字符串内的任何%实例.以下将有效:
'%<table width="100\%" border="0" cellspacing="0" cellpadding="0">.*?</table>%si'
Run Code Online (Sandbox Code Playgroud)