本文整理匯總了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());
}