本文整理汇总了PHP中XString::write2file方法的典型用法代码示例。如果您正苦于以下问题:PHP XString::write2file方法的具体用法?PHP XString::write2file怎么用?PHP XString::write2file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XString
的用法示例。
在下文中一共展示了XString::write2file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processSource
private function processSource($sourceInfo)
{/*{{{*/
if( empty($sourceInfo['tpl']) ||
empty($sourceInfo['data']) ||
empty($sourceInfo['res']))
return false;
foreach ($sourceInfo['data'] as $dataName => $dataFiles)
{
$resDataPath = $this->resPath.$dataName."/";
if (isset($sourceInfo['res']['subset']) && $sourceInfo['res']['subset'])
{
$resDataPath = $this->resPath.$dataName."_".$sourceInfo['res']['subset']."/";
}
XString::clearDir($resDataPath);
foreach($dataFiles as $num => $dataFile)
{
$resData = $this->wrap($sourceInfo['tpl'],$dataFile);
$resDataFile = $resDataPath.$num.".".$sourceInfo['res']['extension'];
XString::write2file($resData, $resDataFile);
$this->myEcho(" 写入 $resDataFile \n");
}
}
}/*}}}*/
示例2: generateIndexBySource
public function generateIndexBySource($className)
{/*{{{*/
$configs = BeanFinder::get('configs');
if(isset(self::$classList[$className]))
{
$tplList = $this->returnTemplatesFromSource($className);
foreach ($tplList as $tpl)
{
$className = str_replace("_".$this->getSuffix($tpl), '', $tpl);
$dataPath = $configs->resPath.strtolower($className);
$xmlData = "<?xml version='1.0' encoding='$this->charset'?><sddindex>";
if (is_dir($dataPath))
{
$handle = opendir($dataPath);
while (false !== ($file = readdir($handle)))
{
if (preg_match('/[0-9]/',$file))
{
$xmlData .= '<sdd><loc>'.$configs->baseUrl.$className."/".$file.'</loc><lastmod>'.XDateTime::now().'</lastmod></sdd>';
}
}
$xmlData .= '</sddindex>';
$file = $dataPath."/index.xml";
XString::write2file($xmlData, $file);
closedir($handle);
echo "目录文件".$file."生成\n";
}
}
}
}/*}}}*/