本文整理匯總了PHP中phpQuery::defaultDocumentID方法的典型用法代碼示例。如果您正苦於以下問題:PHP phpQuery::defaultDocumentID方法的具體用法?PHP phpQuery::defaultDocumentID怎麽用?PHP phpQuery::defaultDocumentID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類phpQuery
的用法示例。
在下文中一共展示了phpQuery::defaultDocumentID方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: selectDocument
/**
* Sets default document to $id. Document has to be loaded prior
* to using this method.
* $id can be retrived via getDocumentID() or getDocumentIDRef().
*
* @param unknown_type $id
*/
public static function selectDocument($id)
{
$id = self::getDocumentID($id);
self::debug("Selecting document '{$id}' as default one");
self::$defaultDocumentID = self::getDocumentID($id);
}
示例2: createDocumentWrapper
/**
* Enter description here...
*
* @param unknown_type $html
* @param unknown_type $domId
* @return unknown New DOM ID
* @todo support PHP tags in input
* @todo support passing DOMDocument object from self::loadDocument
*/
protected static function createDocumentWrapper($html, $contentType = null, $documentID = null)
{
if (function_exists('domxml_open_mem')) {
throw new Exception("Old PHP4 DOM XML extension detected. phpQuery won't work until this extension is enabled.");
return null;
}
$id = $documentID ? $documentID : md5(microtime());
$document = null;
if ($html instanceof DOMDOCUMENT) {
// TODO support cloning of DOMDocumentWrapper
if (self::getDocumentID($html)) {
// document already exists in phpQuery::$documents, make a copy
$document = clone $html;
} else {
// new document, add it to phpQuery::$documents
$wrapper = new DOMDocumentWrapper($html, $contentType);
}
} else {
$wrapper = new DOMDocumentWrapper($html, $contentType);
}
$wrapper->id = $id;
// create document
phpQuery::$documents[$id] = $wrapper;
// remember last loaded document
return self::$defaultDocumentID = $id;
}