本文整理汇总了PHP中SimpleXmlElement::saveXml方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleXmlElement::saveXml方法的具体用法?PHP SimpleXmlElement::saveXml怎么用?PHP SimpleXmlElement::saveXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleXmlElement
的用法示例。
在下文中一共展示了SimpleXmlElement::saveXml方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _asXml
/**
* Output as XML
*
* @param array $shellList
* @return void
*/
protected function _asXml($shellList) {
$plugins = CakePlugin::loaded();
$shells = new SimpleXmlElement('<shells></shells>');
foreach ($shellList as $name => $location) {
$source = current($location);
$callable = $name;
if (in_array($source, $plugins)) {
$callable = Inflector::camelize($source) . '.' . $name;
}
$shell = $shells->addChild('shell');
$shell->addAttribute('name', $name);
$shell->addAttribute('call_as', $callable);
$shell->addAttribute('provider', $source);
$shell->addAttribute('help', $callable . ' -h');
}
$this->stdout->outputAs(ConsoleOutput::RAW);
$this->out($shells->saveXml());
}
示例2: _asXml
/**
* Output as XML
*
* @param array $shellList The shell list.
* @return void
*/
protected function _asXml($shellList)
{
$plugins = CakePlugin::loaded();
$shells = new SimpleXmlElement('<shells></shells>');
foreach ($shellList as $plugin => $commands) {
foreach ($commands as $command) {
$callable = $command;
if (in_array($plugin, $plugins)) {
$callable = Inflector::camelize($plugin) . '.' . $command;
}
$shell = $shells->addChild('shell');
$shell->addAttribute('name', $command);
$shell->addAttribute('call_as', $callable);
$shell->addAttribute('provider', $plugin);
$shell->addAttribute('help', $callable . ' -h');
}
}
$this->stdout->outputAs(ConsoleOutput::RAW);
$this->out($shells->saveXml());
}
示例3: _asXml
/**
* Output as XML
*
* @return void
*/
protected function _asXml($shellList)
{
$plugins = App::objects('plugin');
$shells = new SimpleXmlElement('<shells></shells>');
foreach ($shellList as $name => $location) {
$source = current($location);
$callable = $name;
if (in_array($source, $plugins)) {
$callable = Inflector::underscore($source) . '.' . $name;
}
$shell = $shells->addChild('shell');
$shell->addAttribute('name', $name);
$shell->addAttribute('call_as', $callable);
$shell->addAttribute('provider', $source);
$shell->addAttribute('help', $callable . ' -h');
}
$this->out($shells->saveXml());
}