2012-05-02 25 views

回答

0
$item = "Title http://t.co/xxx"; 
preg_match("/http\S+/", $item, $matches); 
$url = $matches[0]; 
+1

完全正是我想要的,谢谢:} –

0

尝试:

$title = Title http://t.co/xxx 

$final = str_replace("Title ","",$title); 
0
$str = 'Title http://t.co/xxx'; 
echo substr($str, strpos($str, 'http')); 
0

可能是一个很好的时间去学习正则表达式太:)

试一试

<?php 
$s = ' 
Title http://t.co/xxx 
Title http://t.co/yyy 

'; 

$s2 = preg_replace('@(Title |http://t.co/)@i', '', $s); 
echo nl2br($s2); 
?>