编辑:如果有图像链接,我需要获取图像链接。
while ( $row = mysql_fetch_assoc( $result ) ){
$msg = "<div class='msg'>[" . $row["time"] . "] <b>" . $row["name"] . ":</b> " . $row["message"];
echo $msg;
preg_match_all( "/(https?:\/\/\S+\.(?:jpg|png|gif))\s+/", $msg, $urls );
if ( $urls ){
echo "ye, its image";
}
}
答案 0 :(得分:0)
while ( $row = mysql_fetch_assoc( $result ) ){
$msg = "<div class='msg'>[" . $row["time"] . "] <b>" . $row["name"] . ":</b> " . $row["message"];
echo $msg;
preg_match_all( "/(https?:\/\/\S+\.(?:jpg|png|gif))\s+/", $msg, $urls );
if ( $urls ){
echo '<img src=".$urls.">';
}
}