2013-04-12 33 views
0

我有一個網站,用戶可以提交內容。所以我想通過在標籤上添加rel =「nofollow」來避免垃圾鏈接。我該怎麼辦這與jQuery或PHP我如何在ckeditor內容的標籤上添加rel =「nofollow」

<a href="http://mnking.net" rel="nofollow">This is link</a> 
+0

谷歌關於「正則表達式」,並在使用一個你處理用戶評論的php代碼。 –

+0

我認爲,使用經常性的抑鬱症是一種最好的方法 –

回答

0

使用此

$("a[href='http://mnking.net']").attr("rel", "nofollow"); 
0

如果你使用$_POST的鏈接,你可以使用下面的代碼(用PHP編寫):

$url = $_POST['url']; 
$tag = '<a href='.$url.'rel="nofollow">This is link</a>'; 

在PHP中,標誌。 (一個簡單的點)用於連接字符串。 祝你好運。

0

你可以這樣做:

$(document).ready(function(){ 

    $("a").attr("rel", "nofollow"); 

}); 
0

穿上後到一個單獨的DIV,讓我們說class="post" ,然後只是簡單的jQuery代碼:

$('.post a').attr('rel', 'nofollow'); 
相關問題