當前位置: 首頁>>代碼示例>>PHP>>正文


PHP phpQuery::newDocumentFileXHTML方法代碼示例

本文整理匯總了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);
    }
開發者ID:Jesse-Breuer,項目名稱:LayerCake,代碼行數:31,代碼來源:index.php


注:本文中的phpQuery::newDocumentFileXHTML方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。