本文整理汇总了PHP中io::file_get_contents方法的典型用法代码示例。如果您正苦于以下问题:PHP io::file_get_contents方法的具体用法?PHP io::file_get_contents怎么用?PHP io::file_get_contents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io
的用法示例。
在下文中一共展示了io::file_get_contents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
static function get($full = false)
{
$pages = array();
$pageFiles = pages::page_files();
$homeHtml = io::file_get_contents($pageFiles['index.html']);
$homeDoc = phpQuery::newDocument($homeHtml);
$nav = pages::nav_urls($homeDoc);
$nav_urls = array_keys($nav);
foreach ($pageFiles as $rpath => $path) {
$url = pages::rpath2url($rpath);
$home = $url == 'index.html';
$html = $home ? $homeHtml : io::file_get_contents($path);
$doc = $home ? $homeDoc : phpQuery::newDocument($html);
$idx = array_search($url, $nav_urls);
$navtitle = $idx === FALSE ? phpQuery::pq('meta[name="navtitle"]', $doc)->attr('content') : $nav[$url];
$navtitle = empty($navtitle) ? pages::url2navtitle($url) : $navtitle;
$page = array('id' => pages::page_id($html), 'idx' => $idx === FALSE ? -1 : $idx, 'title' => phpQuery::pq('title', $doc)->text(), 'navtitle' => $navtitle, 'desc' => phpQuery::pq('meta[name="description"]', $doc)->attr('content'), 'keywords' => phpQuery::pq('meta[name="keywords"]', $doc)->attr('content'), 'home' => $home, 'url' => $url);
if ($full) {
$page['path'] = pages::rpath2path($rpath);
$page['html'] = $html;
$page['doc'] = $doc;
}
array_push($pages, $page);
}
return array('status' => 0, 'pages' => $pages);
}