本文整理汇总了PHP中xml::get方法的典型用法代码示例。如果您正苦于以下问题:PHP xml::get方法的具体用法?PHP xml::get怎么用?PHP xml::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml
的用法示例。
在下文中一共展示了xml::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wwwtokenize
function wwwtokenize($subject, $pattern)
{
$xml = new xml();
if (preg_match_all("/({$pattern})/", $subject, $matches)) {
foreach ($matches[1] as $string) {
$xml->append($xml->text($string));
}
}
return $xml->get();
}
示例2: documentation
function documentation()
{
$xml = new xml();
$methods = $xml->element('methods');
$xml->append($methods);
foreach ($this->methods as $url => $group) {
foreach ($group->schema() as $schema) {
list($type, $get, $post) = $schema;
$method = $xml->element('method');
$methods->append($method);
$method['@id'] = str_pad(dechex(crc32("{$type}:{$url}:" . implode(':', array_keys($get)) . implode(':', array_keys($post)))), 8, '0', STR_PAD_LEFT);
$method['@url'] = $url;
$method['@type'] = strtoupper($type);
foreach ($get as $name => $param) {
$g = $xml->element('get');
$g['@name'] = $name;
$g['@type'] = $param->type;
$g['@min'] = isset($param->min) ? $param->min : 'default (' . datatype::min($param->type) . ')';
$g['@max'] = isset($param->max) ? $param->max : 'default (' . datatype::max($param->type) . ')';
$g['@required'] = $param->required ? 'true' : 'false';
!isset($param->default) or $g['@default'] = $param->default;
!isset($param->domains) or $g['@domain'] = implode(', ', $param->domains);
$method->append($g);
}
foreach ($post as $name => $param) {
$p = $xml->element('post');
$p['@name'] = $name;
$p['@type'] = $param->type;
$p['@min'] = isset($param->min) ? $param->min : 'default (' . datatype::min($param->type) . ')';
$p['@max'] = isset($param->max) ? $param->max : 'default (' . datatype::max($param->type) . ')';
$p['@required'] = $param->required ? 'true' : 'false';
!isset($param->default) or $p['@default'] = $param->default;
!isset($param->domains) or $p['@domain'] = implode(', ', $param->domains);
$method->append($p);
}
}
}
$xslt = new XSLTProcessor();
$xsl = new DOMDocument();
$xsl->load(www_root . 'backend/documentation.xsl');
$xslt->importStylesheet($xsl);
$documentation = $xslt->transformToDoc($xml->get());
return (object) ['code' => 200, 'message' => 'OK', 'headers' => ['Content-Type' => 'text/html'], 'body' => $documentation->saveXML()];
}