Php-like jQuery control dom | php collection details. you can download the attachment and run it on your own. Some time ago, when I made a PHP collection-related program, I suddenly found a very useful class package developed by foreigners, called "phpQuery ", I already feel familiar with this name. it is a good job for PHP to control dom like jQuery. it is essential to use PHP to collect dom like jQuery. | php collection
For details, you can download the attachment and run it on your own.
Some time ago, when I made a PHP collection-related program, I suddenly found a very useful class package developed by foreigners, called "phpQuery ", I already feel familiar with this name. it is a good job for PHP to control dom like jQuery, and it is essential to use PHP for collection.
First paste some dome code:
Require ('phpquery/phpQuery. php '); $ doc ['Ul> li']-> addClass ('My-new-class')-> filter (': LA ') -> addClass ('last-li ')-> toReference ($ li); foreach ($ ul ['> li '] as $ li) {// iteration returns PLAIN dom nodes, NOT phpQuery objects $ tagName = $ li-> tagName; $ childNodes = $ li-> childNodes; // so you NEED to wrap it within phpQuery, using pq (); pq ($ li)-> addClass ('My-second-new-class ');}
I hope you will like it.