Phpquery (jquery php versiyonu) kullanılarak elemanını değiştirin

0 Cevap php

I <p> phpquery kullanarak tüm <span> etiketleri değiştirmek istiyorum. Ne benim koduyla yanlış? Bu span bulur ama replaceWith fonksiyon şey yapmıyor.

$event = phpQuery::newDocumentHTML(file_get_contents('event.html'));
$formatted_event = $event->find('span')->replaceWith('<p>');

This documentation indicates this is possible:
http://code.google.com/p/phpquery/wiki/Manipulation#Replacing
http://api.jquery.com/replaceWith/

Bu kodu ->replaceWith('<p></p>') ile ve olmadan iade alır html:

<span class="Subhead1">Event 1<br></span><span class="Subhead2">Event 2<br>
    August 12, 2010<br>
    2:35pm <br>
    Free</span>

0 Cevap