本文整理匯總了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>