当前位置: 首页>>代码示例>>PHP>>正文


PHP Files::fileToArray方法代码示例

本文整理汇总了PHP中Files::fileToArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::fileToArray方法的具体用法?PHP Files::fileToArray怎么用?PHP Files::fileToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Files的用法示例。


在下文中一共展示了Files::fileToArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: webpageTextChecker

 public function webpageTextChecker()
 {
     $this->deleteOldFiles();
     $site = Files::fileToArray('sites.txt')[0];
     Curl::cookieCreation($site);
     $pageNumber = -1;
     $pages = self::clearPages();
     $pagesUnique = array_unique($pages);
     foreach ($pagesUnique as $page) {
         self::setTextForSearch($page);
         /* check if page does not start with
            slash then add it */
         if ($page[0] !== "/") {
             if (in_array("/{$page}", $pages)) {
                 continue;
             }
             $page = "/{$page}";
         }
         $textForSearch = self::getTextForSearch();
         $pageNumber++;
         $sitePage = $site . $page;
         echo count($pagesUnique) - $pageNumber . ".", $sitePage . "\n";
         $this->pageTextChecker($page, $pages, $site, $sitePage, $textForSearch);
     }
     $logFileName = 'ptc_log_';
     $log = $this->getLog();
     LogCreation::logFileCreator($log, $logFileName);
 }
开发者ID:Kurets,项目名称:origin,代码行数:28,代码来源:WebpageTextChecker.php

示例2: array

<?php

require_once '../helpers/Helpers.php';
use helpers\Helpers;
$dbLog = Files::csvToArray('logged_time.csv');
$heroLabels = Files::fileToArray('hero_labels.txt');
$groupByPerson = array();
//group by  person and sum log
foreach ($dbLog as $dbLogRow) {
    if (!array_key_exists($dbLogRow[1], $groupByPerson)) {
        $item = ['name' => $dbLogRow[1], 'time' => $dbLogRow[2]];
        $groupByPerson[$dbLogRow[1]] = $item;
    } else {
        $groupByPerson[$dbLogRow[1]]['time'] += $dbLogRow[2];
    }
}
//add percent to log from database
$dbLogPercent = $dbLog;
foreach ($dbLogPercent as &$dbLogPercRow) {
    foreach ($groupByPerson as $groupByPersonRow) {
        if ($dbLogPercRow[1] == $groupByPersonRow['name']) {
            $dbLogPercRow['%'] = round($dbLogPercRow[2] * 100 / $groupByPersonRow['time'], 2) . '%';
        } elseif (!in_array($dbLogPercRow[0], $heroLabels)) {
            $dbLogPercRow[0] = 'Else';
        }
    }
}
unset($dbLogPercRow);
//create array with people from dbLog
$people = array();
foreach ($dbLogPercent as $dbLogPercKey => $dbLogPercRow) {
开发者ID:Kurets,项目名称:origin,代码行数:31,代码来源:timecount.php

示例3: websiteTextChecker

 public function websiteTextChecker()
 {
     self::deleteOldFiles();
     $sites = Files::fileToArray('sites.txt');
     $pagesFromFile = Files::fileToArray('pages.txt');
     $siteNumber = -1;
     $textForSearch = Files::fileToArray('text_for_search.txt');
     foreach ($sites as $site) {
         $site = InputInfoValidator::siteNameValidator($site);
         if (!is_null(GetAllHrefs::getOptsForPages())) {
             options:
             GetAllHrefs::setOptsForPages();
         }
         if (in_array(GetAllHrefs::getOptsForPages(), array(1, 3))) {
             if (!isset($checkBlog)) {
                 $checkBlog = GetAllHrefs::setCheckBlog();
             }
             Curl::cookieCreation($site);
             $sitePage = $site;
             $curlForLinks = Curl::getCurlResult($sitePage)[0];
             $pages = GetAllHrefs::getHrefs($site, $curlForLinks);
             if (GetAllHrefs::getOptsForPages() == 3) {
                 $pagesCurl = $pages;
                 $pages = array_merge($pagesCurl, $pagesFromFile);
             }
         } elseif (GetAllHrefs::getOptsForPages() == 2) {
             Curl::cookieCreation($site);
             $pages = $pagesFromFile;
         } else {
             goto options;
         }
         $pageNumber = -1;
         $siteNumber++;
         foreach ($pages as $key => &$page) {
             $pageNumber++;
             if (strpos($page, $site) == TRUE) {
                 $sitePage = $page;
             } else {
                 /* check if page does not start with
                    slash then add it */
                 if ($page[0] !== "/") {
                     if (in_array("/{$page}", $pages)) {
                         continue;
                     }
                     $page = "/{$page}";
                 }
                 $sitePage = "{$site}{$page}";
             }
             #counter for pages, which are being checker
             echo count($sites) - $siteNumber . ".", count($pages) - $pageNumber . ".", $sitePage . "\n";
             self::pageTextChecker($page, $pages, $site, $sitePage, $textForSearch);
         }
     }
     $logFileName = 'wtc_log_';
     $log = $this->log;
     LogCreation::logFileCreator($log, $logFileName);
 }
开发者ID:Kurets,项目名称:origin,代码行数:57,代码来源:WebsiteTextChecker.php


注:本文中的Files::fileToArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。