I have this:
$content = htmlspecialchars($show["status"]);
if (preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+#", $content, $matches)) {
foreach(arr开发者_C百科ay_unique($matches) as $m) {
?><a id="<?php echo $m; ?>" data-id="<?php echo $id; ?>" class="fancybox_vid"><img src="images/icons/youtube.png" style="margin-right: 4px;"></a><?php
}
}
echo $content;
Right now if there exists 2 links in $content, it will only make 1 anchor+imageicon, but I want it to then make two anchor+imageicon? What is wrong and how can i fix this?
I tried remove the array_unique, made no difference.
Try using preg_match_all.
精彩评论