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


PHP iPHP::timer_stop方法代码示例

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


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

示例1: crawl


//.........这里部分代码省略.........
         }
         $content = spiderContent::crawl($content_html, $data, $rule, $responses);
         unset($content_html);
         if (strpos($dname, 'ARRAY:') !== false) {
             // if(strpos($data['rule'], 'RULE@')!==false){
             $dname = str_replace('ARRAY:', '', $dname);
             // $contentArray = $responses[$dname];
             // // $contentArray = $responses[$dname];
             $cArray = array();
             foreach ((array) $content as $k => $value) {
                 foreach ((array) $value as $key => $val) {
                     $cArray[$key][$k] = $val;
                 }
             }
             if ($cArray) {
                 $content = $cArray;
                 unset($cArray);
             }
         }
         /**
          * [name.xxx]
          * 采集内容做为数组
          */
         if (strpos($dname, '.') !== false) {
             $f_key = substr($dname, 0, stripos($dname, "."));
             $s_key = substr(strrchr($dname, "."), 1);
             if (isset($responses[$f_key][$s_key])) {
                 if (is_array($responses[$f_key][$s_key])) {
                     $responses[$f_key][$s_key] = array_merge($responses[$f_key][$s_key], $content);
                 } else {
                     $responses[$f_key][$s_key] .= $content;
                 }
             } else {
                 $responses[$f_key][$s_key] = $content;
             }
         } else {
             /**
              * 多个name 内容合并
              */
             if (isset($responses[$dname])) {
                 if (is_array($responses[$dname])) {
                     $responses[$dname] = array_merge($responses[$dname], $content);
                 } else {
                     $responses[$dname] .= $content;
                 }
             } else {
                 $responses[$dname] = $content;
             }
         }
         /**
          * 对匹配多条的数据去重过滤
          */
         if (!is_array($responses[$dname]) && $data['multi']) {
             if (strpos($responses[$dname], ',') !== false) {
                 $_dnameArray = explode(',', $responses[$dname]);
                 $dnameArray = array();
                 foreach ((array) $_dnameArray as $key => $value) {
                     $value = trim($value);
                     $value && ($dnameArray[] = $value);
                 }
                 $dnameArray = array_filter($dnameArray);
                 $dnameArray = array_unique($dnameArray);
                 $responses[$dname] = implode(',', $dnameArray);
                 unset($dnameArray, $_dnameArray);
             }
         }
         gc_collect_cycles();
     }
     if (isset($responses['title']) && empty($responses['title'])) {
         $responses['title'] = $responses['__title__'];
     }
     spider::$allHtml = null;
     unset($html);
     gc_collect_cycles();
     if (spider::$dataTest) {
         echo "<pre style='width:99%;word-wrap: break-word;'>";
         print_r(iS::escapeStr($responses));
         echo '<hr />';
         echo '使用内存:' . iFS::sizeUnit(memory_get_usage()) . ' 执行时间:' . iPHP::timer_stop() . 's';
         echo "</pre>";
     }
     iFS::$CURLOPT_ENCODING = '';
     iFS::$CURLOPT_REFERER = '';
     iFS::$watermark_config['pos'] = iCMS::$config['watermark']['pos'];
     iFS::$watermark_config['x'] = iCMS::$config['watermark']['x'];
     iFS::$watermark_config['y'] = iCMS::$config['watermark']['y'];
     iFS::$watermark_config['img'] = iCMS::$config['watermark']['img'];
     $rule['fs']['encoding'] && (iFS::$CURLOPT_ENCODING = $rule['fs']['encoding']);
     $rule['fs']['referer'] && (iFS::$CURLOPT_REFERER = $rule['fs']['referer']);
     if ($rule['watermark_mode']) {
         iFS::$watermark_config['pos'] = $rule['watermark']['pos'];
         iFS::$watermark_config['x'] = $rule['watermark']['x'];
         iFS::$watermark_config['y'] = $rule['watermark']['y'];
         $rule['watermark']['img'] && (iFS::$watermark_config['img'] = $rule['watermark']['img']);
     }
     if (spider::$callback['data'] && is_callable(spider::$callback['data'])) {
         $responses = call_user_func_array(spider::$callback['data'], array($responses));
     }
     return $responses;
 }
开发者ID:Junred,项目名称:iCMS,代码行数:101,代码来源:iSpider.Data.php

示例2: do_createArticle

 function do_createArticle($aid = null)
 {
     $category = $this->PG['cid'];
     $startime = $this->PG['startime'];
     $endtime = $this->PG['endtime'];
     $startid = $this->PG['startid'];
     $endid = $this->PG['endid'];
     $perpage = (int) $this->PG['perpage'];
     $offset = (int) $this->PG['offset'];
     $orderby = $this->PG['orderby'];
     $whereSQL = "WHERE `status` ='1'";
     $aid === null && ($aid = $this->PG['aid']);
     if ($aid) {
         $title = self::Article($aid);
         iPHP::success($title . '<hr />生成静态完成!');
     }
     $category[0] == 'all' && ($category = $this->get_category(iCMS_APP_ARTICLE));
     if ($category) {
         $cids = implode(',', (array) $category);
         $whereSQL .= " AND `cid` IN({$cids})";
     }
     $startime && ($whereSQL .= " AND `pubdate`>=UNIX_TIMESTAMP('{$startime} 00:00:00')");
     $endtime && ($whereSQL .= " AND `pubdate`<=UNIX_TIMESTAMP('{$endtime} 23:59:59')");
     $startid && ($whereSQL .= " AND `id`>='{$startid}'");
     $endid && ($whereSQL .= " AND `id`<='{$endid}'");
     $perpage or $perpage = $this->CP;
     $orderby or $orderby = "id DESC";
     $total = iPHP::total(false, "SELECT count(*) FROM `#iCMS@__article` {$whereSQL}", "G");
     $looptimes = ceil($total / $perpage);
     $offset = $this->page * $perpage;
     $rs = iDB::all("SELECT `id` FROM `#iCMS@__article` {$whereSQL} order by {$orderby} LIMIT {$offset},{$perpage}");
     $_count = count($rs);
     $msg = "共<span class='label label-info'>{$total}</span>篇文章,将分成<span class='label label-info'>{$looptimes}</span>次完成<hr />开始执行第<span class='label label-info'>" . ($this->page + 1) . "</span>次生成,共<span class='label label-info'>{$_count}</span>篇<hr />";
     for ($i = 0; $i < $_count; $i++) {
         self::Article($rs[$i]['id']);
         $msg .= '<span class="label label-success">' . $rs[$i]['id'] . ' <i class="fa fa-check"></i></span> ';
     }
     $GLOBALS['page']++;
     $use_time = iPHP::timer_stop();
     $msg .= "<hr />用时<span class='label label-info'>{$use_time}</span>秒";
     $query["total_num"] = $total;
     $query["alltime"] = $this->alltime + $use_time;
     $loopurl = $this->loopurl($looptimes, $query);
     if ($loopurl) {
         $moreBtn = array(array("id" => "btn_stop", "text" => "停止", "url" => APP_URI . "&do=article"), array("id" => "btn_next", "text" => "继续", "src" => $loopurl, "next" => true));
         $dtime = 1;
         $all_time = $looptimes * $use_time + $looptimes + 1;
         $msg .= "<hr />预计全部生成还需要<span class='label label-info'>{$all_time}</span>秒";
     } else {
         $moreBtn = array(array("id" => "btn_next", "text" => "完成", "url" => APP_URI . "&do=article"));
         $dtime = 5;
         $msg .= "<hr />已全部生成完成<hr />总共用时<span class='label label-info'>" . $query["alltime"] . "</span>秒";
     }
     $updateMsg = $this->page ? true : false;
     iPHP::dialog($msg, $loopurl ? "src:" . $loopurl : '', $dtime, $moreBtn, $updateMsg);
 }
开发者ID:World3D,项目名称:iCMS,代码行数:56,代码来源:html.app.php

示例3: defined

 * @license http://www.idreamsoft.com iDreamSoft
 * @author coolmoo <idreamsoft@qq.com>
 * @$Id: footer.php 2381 2014-03-21 04:03:07Z coolmoo $
 */
defined('iPHP') or exit('What are you doing?');
//var_dump(iMember::$cpower);
$memory = memory_get_usage();
?>
  <div class="clearfloat"></div>
  <div class="iCMS-container hide">
    <span class="label label-success">
      使用内存:<?php 
echo iFS::sizeUnit($memory);
?>
 执行时间:<?php 
echo iPHP::timer_stop();
?>
 s
    </span>
  </div>
</div>
<a id="scrollUp" href="#top"></a>
<div class="iCMS-batch">
  <div id="weightBatch">
    <div class="input-prepend"><span class="add-on">权重</span>
      <input type="text" class="span2" name="mweight"/>
    </div>
  </div>
  <div id="keywordBatch">
    <div class="input-prepend input-append"><span class="add-on">关键字</span>
      <input type="text" class="span2" name="mkeyword"/>
开发者ID:sunhk25,项目名称:iCMS,代码行数:31,代码来源:admincp.footer.php


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