本文整理汇总了PHP中Resource::getXmlArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Resource::getXmlArray方法的具体用法?PHP Resource::getXmlArray怎么用?PHP Resource::getXmlArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resource
的用法示例。
在下文中一共展示了Resource::getXmlArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xml2ArrayFile
function xml2ArrayFile($dir, $file)
{
$fileWithPath = $dir . DIRECTORY_SEPARATOR . $file;
echo $fileWithPath . "\n";
$xmlArr = Resource::getXmlArray($fileWithPath);
$baseFile = substr($file, 0, strlen($file) - 4);
$phpFile = $baseFile . '.conf.php';
$phpFileWithPath = $dir . DIRECTORY_SEPARATOR . $phpFile;
$text = "<?php \n";
$text .= 'return ';
$text .= var_export($xmlArr, true);
$text .= ';';
//file_puts_contents('/home/k6/public_html/synfac/myfile.php', $text);
$fh = fopen($phpFileWithPath, "w") or die("Could not open log file.");
fwrite($fh, $text) or die("Could not write file!");
fclose($fh);
}
示例2:
/**
* Get Xml Array.
* If xml file has been compiled (has .cmp), load the cmp file as array;
* otherwise, compile the .xml to .cmp first new 2.2.3, .cmp files
* will be created in app/cache/metadata_cmp directory. replace '/' with '_'
* for example, /module/demo/BOEvent.xml has cmp file as _module_demo_BOEvent.xml
*
* @param string $xmlFile
* @return array
**/
public static function &getXmlArray($xmlFile)
{
return Resource::getXmlArray($xmlFile);
}