I want to find this pattern and replace it with the following string
<... href="http://test1.com/img/abc/def.jpg/>
<....src="http://test2.com/img/ghi/ijk.jpg/>
<....src="http://test1.com/img/ghi/xyz.jpg/>
<... href="http://test2.com/img/abc/lkm.jpg/>
and so on.
Can somebody give me an idea of what should be the logic or algorithm to do this pattern replacement?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
您应该创建一个方法来生成 URL,而不是尝试对响应文本本身执行此操作。此方法将从某些配置列表中随机选择一个主机(没有充分的理由严格交替)。
Rather than attempting to do this on the response text itself, you should create a method to generate URLs. This method would randomly pick a host from some configured list (there's no good reason to strictly alternate).
这就是我所做的,我建议您也这样做:
www
im1< /code>
im2
在您的网页中,只需放置图像的完整链接,例如:
http: //im1.example.com/image1.jpg
http://im2.example.com/image2.jpg
但我的第一个建议是:仔细阅读 YahooSlow 插件的所有建议,这是关于网站优化。
Here's what I do, and I would suggest you to do the same:
www
im1
im2
In your web pages, just put full links to images like:
http://im1.example.com/image1.jpg
http://im2.example.com/image2.jpg
But my first advice would be: read carefully all the recommandations from the YahooSlow plugin, which are the best ones about website optimization.