0
我有一個$object
從json對象讀取。我正在使用_filter_url()
函數在drupal中將文本顯示爲url。刪除從json輸出分號
每當有超過1個網址時,它會在第1個網址的末尾顯示分號。我如何刪除它?這意味着我需要這些網址以及其下面沒有超鏈接的分號。
function test($object){
echo str_replace('; ','',$object); //this removes the ; but I need the semicolon also to be displayed without any hyperlink below it.
}
function test($object) {
$x = explode(';',$object);
for($i=0;$i<count($x);$i++) {
echo _filter_url($x[$i]); //even this removes the semicolon, but i want the semicolon to be displayed at the middle of multiple urls, however the semicolon should not have the hyperlink under
}
}
thatI得到的輸出是:
URL1 URL2每個URL是在單獨的線
所需的輸出是:
URL1;
URL2
我需要多個網址之間的分號。 但是這個分號不應該是超鏈接的一部分
在您的示例代碼和描述中使用$對象使得這更難理解(因爲它看起來像一個字符串)。你應該向我們展示預期的輸入,錯誤的輸出以及你實際想要的結果。 – mario 2011-02-24 22:28:30