类似jQuery的PHP接口? [英] jQuery-like interface for PHP?
问题描述
我很好奇PHP是否存在用于处理HTML / XML文件的jQuery风格的接口/库 - 特别是使用jQuery风格 selectors 。
我想做这样的事情(所有假设的):
foreach(j(div> p> a)as anchor){
// ...
}
print j(#some_id) - > html();
print j(a) - > eq(0) - > attr(name);
这些只是一些例子。
我尽可能多地使用谷歌搜索我可以但找不到我在找的东西。有人知道是否存在这样的行,或者这是我必须从头开始自己使用domxml?
解决方案
php / jquery / php / jquery / php / jquery / php / jquery / php / jquery / jquery介意其他用途。 I was curious as to whether or not there exists a jQuery-style interface/library for PHP for handling HTML/XML files -- specifically using jQuery style selectors. I'd like to do things like this (all hypothetical): These are just a few examples. I did as much Googling as I could but couldn't find what I was looking for. Does anyone know if something along these lines exist, or is this something I'm going to have to make from scratch myself using domxml? Doing some more hunting, I think I might've found precisely what I was looking for: Thanks everyone for your answers, I will definitely keep them in mind for other uses. 这篇关于类似jQuery的PHP接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
foreach (j("div > p > a") as anchor) {
// ...
}
print j("#some_id")->html();
print j("a")->eq(0)->attr("name");