2
我有用戶輸入的超鏈接已被證明。這造成以下情形在我的html:找到與PHP的超鏈接中的空白,並修復它們
<a href="http:// www. web site link .com ">Website link bro ken </a>
我如何使用PHP來解決這一問題上的頁面加載或腳本我在我的數據庫上運行,以實現這一目標:
<a href="http://www.websitelink.com">Website link bro ken</a> (the link text I guess is impossible to fix without checkning if parts of words could fit together - as long as the link works, the on screen justification will have to pass.
請緊記住這些發生在大量的文本中。因此,尋找空間將首先找到每個鏈接,然後「修復」它。
差不多。在替換表達式中使用''0'',否則它將失去`href =「`前綴,並且replaceSpaces可能更好地使用str_replace,否則使用`/ \ s + /`來查找所有空白變體。 – mario 2011-02-09 13:28:32