本文整理汇总了PHP中phpQuery::newDocumentFileXHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP phpQuery::newDocumentFileXHTML方法的具体用法?PHP phpQuery::newDocumentFileXHTML怎么用?PHP phpQuery::newDocumentFileXHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpQuery
的用法示例。
在下文中一共展示了phpQuery::newDocumentFileXHTML方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Copyright
<?php
/*
Layercake 1.0 Copyright(c) 2010 by Jesse Breuer distributed under the terms of the GNU General Public License.
*/
require 'process/phpQuery-onefile.php';
$doc = phpQuery::newDocumentFileXHTML('./input.htm');
function array_push_assoc($array, $key, $value)
{
//needed to add associative attr=>value pairs to the array
$array[$key] = $value;
return $array;
}
//close function
$attrs = array("id", "class", "bgc", "txc", "bdc", "fts", "flh", "ilh", "wid", "cmn", "amn", "tmn", "rmn", "bmn", "lmn", "abd", "tbd", "rbd", "bbd", "lbd", "apd", "tpd", "rpd", "bpd", "lpd", "innerWidth");
//list all of the attributes.
$attrsLength = count($attrs) - 1;
$removables = array_slice($attrs, 2);
//the ones we will strip out at the end
$removablesLength = count($removables) - 1;
$divs = array();
//make the divs an associative array containing attr=>value pairs
$numberOfDivs = $doc["div"]->size() - 1;
for ($i = 0; $i <= $numberOfDivs; $i++) {
//loop through the divs to build an array
$divs[$i] = array();
for ($j = 0; $j <= $attrsLength; $j++) {
//loop through the attribute => value pairs for each div in the array
$valueOfAttr = $doc["div:eq({$i})"]->attr("{$attrs[$j]}");
$divs[$i] = array_push_assoc($divs[$i], $attrs[$j], $valueOfAttr);
}