2012-09-15 33 views

回答

1

試試這個

$charsToRemove = array('<p>','</p>'); 
$modifyString = str_ireplace($charsToRemove ,'',$string); 
+0

謝謝你,我明白了;) –

+0

歡迎:) – Tarun

+1

+1很簡單很好 – FirmView

0

你想從數據庫中顯示值?

然後,

如果你正在使用MySQL,

$res = mysql_query("SELECT colName FROM tableName"); 
    if(mysql_num_rows($res) > 0){ 
    $ret = mysql_fetch_assoc($res); 
    echo $ret['colName']; 
    } 
+1

^不要使用mysql_ *函數;棄用流程已經開始,請使用mysqli或PDO。 – Daedalus

+0

+1是的,我知道。 – FirmView

0
<?php 
$html="<p>text text test text</p><p>demo demo demo</p>"; 
preg_match_all("'<p>(.*?)</p>'si", $html, $match); 
if ($match) { 
    $var1 = $match[1][0]; 
    $var2 = $match[1][1]; 
} 
echo $var1."\n"; 
echo $var2."\n"; 
?> 

你只有兩個< p>標籤?如果沒有,你需要循環$ match [1]數組來檢索所有數據。

+0

1,000,000謝謝:) –