本文整理汇总了PHP中Filesystem::getFileContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::getFileContent方法的具体用法?PHP Filesystem::getFileContent怎么用?PHP Filesystem::getFileContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filesystem
的用法示例。
在下文中一共展示了Filesystem::getFileContent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public static function get()
{
$rmFile = preg_replace("/\\/\\*([^x00]*)\\*?\\/?\\*\\//U", "", Filesystem::getFileContent(Config::ROADMAP));
$roadMap = JSON::decode($rmFile, true);
$tmpl = self::$_attr;
$cnt = 0;
$good = is_array($roadMap);
//print_r( $roadMap ); die;
for ($i = 0; $good && is_array($roadMap) && $i < count($roadMap); $i++) {
$el = $roadMap[$i];
foreach ($el as $k => $v) {
if (($pos = array_search($k, $tmpl)) !== FALSE) {
$tmpl[$pos] = "asnfcjrwpht984fh9prewgf84fds";
$cnt++;
}
}
$good = $cnt == count(self::$_attr);
}
if ($good) {
return $roadMap;
} else {
self::raiseException(ERR_ROADMAP);
return NULL;
}
}
示例2: xmlTree
public static function &buildTree($source, $mode = XMLDocument::BUILD_MODE_FROM_FILE, $ns = NULL)
{
if ($mode == XMLDocument::BUILD_MODE_FROM_FILE) {
if (($content = Filesystem::getFileContent($source)) === NULL) {
return NULL;
}
} else {
if ($source == "" || $source == NULL) {
return new xmlTree();
}
$content = $ns == NULL ? "<ROOT>" . $source . "</ROOT>" : "<ROOT xmlns:{$ns}=\".\">" . $source . "</ROOT>";
}
/*$content = ereg_replace( "&", "&", $content );
$content = ereg_replace( "&", "&", $content );*/
//echo $content;
$content = preg_replace("/&/", "&", $content);
$content = preg_replace("/&/", "&", $content);
$content = iconv("windows-1251", "UTF-8", $content);
$reader = new XMLReader();
if ($reader->XML($content)) {
$_docTree = NULL;
$_docTree = new xmlTree();
self::_appendChilds($_docTree->getCurrent(), $reader, 0);
$reader = NULL;
return $_docTree;
} else {
self::raiseException(ERR_XML_INVALID_XML, $content);
return NULL;
}
}
示例3: getComp
public static function getComp($key, $callback_args)
{
if (self::_exists($key)) {
$c = Filesystem::getFileContent(Config::CACHE_DIR . DS . "cache" . DS . $key . ".cache.php");
//echo ( microtime () - self::$_t )."<br/>";
return unserialize($c);
} else {
$filename = Config::CACHE_DIR . DS . "cache" . DS . $key . ".cache.php";
$content = call_user_func($callback_args);
//echo ( microtime () - self::$_t )."<br/>";
Filesystem::saveToFile($filename, serialize($content));
return $content;
}
}
示例4: _compileTemplate
protected function _compileTemplate($template, $saltAndPepper, $cache = false)
{
if (isset($this->_templ_cache[$template])) {
$template = $this->_templ_cache[$template];
} else {
$template_name = $template;
$template = Filesystem::getFileContent(__ROOT_PATH . DS . "component" . DS . get_class($this) . DS . $template);
if ($cache) {
$this->_templ_cache[$template_name] = $template;
}
}
if (!is_array($saltAndPepper) || isset($saltAndPepper[0]) || !is_string($template)) {
return NULL;
}
/* else */
$pattern = array_keys($saltAndPepper);
for ($i = 0; $i < count($pattern); $i++) {
$pattern[$i] = "/%" . $pattern[$i] . "%/";
}
$replacement = array_values($saltAndPepper);
return preg_replace($pattern, $replacement, $template);
}