![]() |
[طلب] بحث في مصفوفة السلام عليكم ورحمة الله وبركاته لدي كود يقوم باستخراج الروابط من النص ولكنني اريد حدف الروابط المكسورة مثال رمز PHP: http://www.traidnt.net/vb/newthread...php?do=newthread&f=107 اريد اي رابط يحتوي على ... حذفها في المصفوفة وجلب الصالحة فقط مثال رمز PHP: http://www.traidnt.net/vb/newthread.php?do=newthread&f=10007 الكود كامل رمز PHP: $up_url = 'http://www.traidnt.net/vb/newthread...php?do=newthread&f=107http://www.traidnt.net/vb/newthread.php?do=newthread&f=10007http://www.traidnt.net/vb/newthread.php?do=newthread&f=102548'; function getUrls($string) { $regex = '/https?\:\/\/[^\" ]+/i'; preg_match_all($regex, $string, $matches); return ($matches[0]); } $urls = getUrls($up_url); foreach($urls as $url) { $url = strip_tags($url); $url_pattern = '((https?|ftp|http):((//)|(\\\\))?(www[.])?([A-z]+.)?(traidnt)\.[\w\d:#@%/;$()~_?\+-=\\\.&]*)'; $myString = $url; preg_match_all($url_pattern, $myString, $matches); foreach($matches[0] as $key => $link) { if (@!in_array($link, $links)) { $links[] = $link; $link = strip_tags($link); echo $link.''; } } } وشكرا لكم |
الساعة الآن 03:14 AM |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.5.2 TranZ By
Almuhajir