preg_replaceで使用するには、配列で$withを作成する必要がありますか?
foreach($matches[0] as $match) {
$sql = "insert into url values('$id','$match','$shorturl')";
mysql_query($sql,$con);
$with="<a href=\"http://127.0.0.1/url1/". $shorturl ."\">http://127.0.0.1/". $shorturl ."</a>";
}
$html_links = preg_replace('"\b(http://\S+)"',$with , $_POST['url']);
何か助けはありますか?