关于preg_match_all语句 [英] about preg_match_all statement

查看:81
本文介绍了关于preg_match_all语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




i编写以下代码,以便在我提交网址时从网站捕获图像。同样,我想从网站上捕获文本信息.plz告诉那个.tzz的代码对我有什么帮助。


[php]


<?php


$ content = file_get_contents($ url);

preg_match_all(" /< img(。*)src =(\" |'')(。*)(\" | \'')(。*) [\ /]?> / siU",$ content,$ match,PREG_PATTERN_ORDER);


echo"< b>捕获图片:< / b>< br>" ;;

echo"< br>" ;;

print_r($ match [0]);

echo" ;< br>" ;;

echo"< br>" ;;

echo"< b> Capture Images网址:< / b> < br>< br>" ;;

preg_match_all(" /< img(。*)src =(\" |'')(。*)(\" ; | \'')(。*)[\ /]?> / siU",$ content,$ match,PREG_PATTERN_ORDER);

print_r($ match [3]);

[/ php]

解决方案

content = file_get_contents(


url);

preg_match_all(" /< img(。*)src =(\" |'')(。*)(\" | \'')(。*) [\ /]> /兆",

内容,

hi,

i write the below code to capture the images from the website when i submit the url.In the same way i want to capture the Text information from the website.plz tell that whats the code for that.plz help me.


[php]

<?php

$content= file_get_contents($url);
preg_match_all( "/<img(.*)src=(\"|'')(.*)(\"|\'')(.*)[\/]?>/siU", $content, $match, PREG_PATTERN_ORDER);

echo "<b>Capture Images :</b><br>";
echo "<br>";
print_r($match[0]);
echo "<br>";
echo "<br>";
echo "<b>Capture Images URLS :</b><br><br>";
preg_match_all( "/<img(.*)src=(\"|'')(.*)(\"|\'')(.*)[\/]?>/siU", $content, $match, PREG_PATTERN_ORDER);
print_r($match[3]);
[/php]

解决方案

content= file_get_contents(


url);
preg_match_all( "/<img(.*)src=(\"|'')(.*)(\"|\'')(.*)[\/]?>/siU",


content,


这篇关于关于preg_match_all语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆