有一個字符串$processhtml包含一些HTML。我試圖從PHP的幫助下刪除所有鏈接標記及其內容。 舉例說明: "This is some text with <a href="#">link</a>"
有可能成爲: "This is some text with"
我做一些其他的解析與DOM文檔的幫助,HTML,所以試圖找到與DOM的解決方案。 我已經試過: $dom = new
我正在使用以下代碼刪除html中的空白。我只想刪除兩個標籤之間的空格。但是,下面的代碼替換所有空格 即刪除「>」和之間的所有空格「<」 //read the entire string
$str=file_get_contents('sample.txt');
//replace all white spaces
$str=str_replace("\n", "",$str);
$str
我使用此代碼xml_encode我的數組。 public function xml_encode($mixed, $domElement=null, $DOMDocument=null) {
if (is_null($DOMDocument)) {
$DOMDocument =new DOMDocument;
$DOMDocument->formatOutput