jizuscreed/phpquery 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jizuscreed/phpquery

最新稳定版本:1.1

Composer 安装命令:

composer require jizuscreed/phpquery

包简介

Fork of electrolinux/phpquery with php7.x compatibility. phpQuery is a server-side, chainable, CSS3 selector driven Document Object Model (DOM) API based on jQuery JavaScript Library

README 文档

README

What this fork created for

Original repo (electrolinux/phpquery) is not compatible with php7.x and throws "Array and string offset access syntax with curly braces is deprecated". This repo fixes this trouble, enjoy

There is original readme below:

phpQuery, one more fork!

Note: I haven't used this package since many years, and just recently looked at the code: this is scary, buggy and unfinished. Please don't use it on any production server!

My intent is to have it easily integrated in differents projects, so available on packagist. I've gathered some fix and new features here and there, as will keep looking for new stuff on github about phpQuery

github repos i've integrated:

github repos i've looked at:

Manual

Extracts from fmorrow README.md:

Whats phpQuery?

To quote the phpQuery (orignally concieved and developed by Tobiasz Cudnik, available on Google Code and Github) project documentation:

phpQuery is a server-side, chainable, CSS3 selector driven Document Object Model (DOM) API based on jQuery JavaScript Library.

Library is written in PHP5 and provides additional Command Line Interface (CLI).

Example usage

(copied from http://code.google.com/p/phpquery/wiki/Basics)

Complete working example:

<?php
include 'phpQuery-onefile.php';

$file = 'test.html'; // see below for source

// loads the file
// basically think of your php script as a regular HTML page running client side with jQuery.  This loads whatever file you want to be the current page
phpQuery::newDocumentFileHTML($file);

// Once the page is loaded, you can then make queries on whatever DOM is loaded.
// This example grabs the title of the currently loaded page.
$titleElement = pq('title'); // in jQuery, this would return a jQuery object.  I'm guessing something similar is happening here with pq.

// You can then use any of the functionality available to that pq object.  Such as getting the innerHTML like I do here.
$title = $titleElement->html();

// And output the result
echo '<h2>Title:</h2>';
echo '<p>' . htmlentities( $title) . '</p>';

?>

====

Source for test.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Hello World!</title>
</head>
<body>
</body>
</html>

统计信息

  • 总下载量: 818
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 449
  • 开发语言: HTML

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-09-03