9

这个错误的正则最早是哪儿流传出来的呢?

 4 years ago
source link: https://www.v2ex.com/t/788742
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  PHP

这个错误的正则最早是哪儿流传出来的呢?

  wdssmq · 14 小时 31 分钟前 · 2243 次点击

$pattern="/<[img|IMG].*?src=[\'|\"](.*?(?:[\.gif|\.jpg|\.png]))[\'|\"].*?[\/]?>/";

↑↑ 用来匹配内容中的图片,但是 [img|IMG] 匹配到的是 i 或 I 。。

$pattern = '/<img[^>]*src="([^"]+)"[^>]*>/i';

↑↑ 如果数据中用了单引号,,那是数据的错误 →_→


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK