Php-like jQuery-based dom | php collection

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.