本文整理汇总了PHP中text::xmlData方法的典型用法代码示例。如果您正苦于以下问题:PHP text::xmlData方法的具体用法?PHP text::xmlData怎么用?PHP text::xmlData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类text
的用法示例。
在下文中一共展示了text::xmlData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xmlTree
protected function xmlTree(array $tree)
{
$xml = '<dir readable="' . ($tree['readable'] ? "yes" : "no") . '" writable="' . ($tree['writable'] ? "yes" : "no") . '" removable="' . ($tree['removable'] ? "yes" : "no") . '" hasDirs="' . ($tree['hasDirs'] ? "yes" : "no") . '"' . (isset($tree['current']) ? ' current="yes"' : '') . '><name>' . text::xmlData($tree['name']) . '</name>';
if (isset($tree['dirs']) && is_array($tree['dirs']) && count($tree['dirs'])) {
$xml .= "<dirs>";
foreach ($tree['dirs'] as $dir) {
$xml .= $this->xmlTree($dir);
}
$xml .= "</dirs>";
}
$xml .= '</dir>';
return $xml;
}
示例2: foreach
<root>
<?php
foreach ($dirs as $dir) {
?>
<dir readable="<?php
echo $dir['readable'] ? "yes" : "no";
?>
" writable="<?php
echo $dir['writable'] ? "yes" : "no";
?>
" removable="<?php
echo $dir['removable'] ? "yes" : "no";
?>
" hasDirs="<?php
echo $dir['hasDirs'] ? "yes" : "no";
?>
">
<name><?php
echo text::xmlData($dir['name']);
?>
</name>
</dir>
<?php
}
?>
</root>
示例3: foreach
<root>
<?php
if (is_array($message)) {
?>
<?php
foreach ($message as $msg) {
?>
<error><?php
echo text::xmlData($msg);
?>
</error>
<?php
}
?>
<?php
} else {
?>
<error><?php
echo text::xmlData($message);
?>
</error>
<?php
}
?>
</root>
示例4:
?>
" readable="<?php
echo $file['readable'] ? "yes" : "no";
?>
" writable="<?php
echo $file['writable'] ? "yes" : "no";
?>
" bigIcon="<?php
echo $file['bigIcon'] ? "yes" : "no";
?>
" smallIcon="<?php
echo $file['smallIcon'] ? "yes" : "no";
?>
" thumb="<?php
echo $file['thumb'] ? "yes" : "no";
?>
" smallThumb="<?php
echo $file['smallThumb'] ? "yes" : "no";
?>
">
<name><?php
echo text::xmlData($file['name']);
?>
</name>
</file>
<?php
}
?>
</files>
</root>
示例5:
<root>
<name><?php
echo text::xmlData($name);
?>
</name>
</root>