• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP gc_mem_caches函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中gc_mem_caches函数的典型用法代码示例。如果您正苦于以下问题:PHP gc_mem_caches函数的具体用法?PHP gc_mem_caches怎么用?PHP gc_mem_caches使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: createMap

 /**
  * Iterate over all files in the given directory searching for classes.
  *
  * @param \Iterator|string $dir The directory to search in or an iterator
  *
  * @return array A class map array
  */
 public static function createMap($dir)
 {
     if (is_string($dir)) {
         $dir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir));
     }
     $map = array();
     foreach ($dir as $file) {
         if (!$file->isFile()) {
             continue;
         }
         $path = $file->getRealPath();
         if (pathinfo($path, PATHINFO_EXTENSION) !== 'php') {
             continue;
         }
         $classes = self::findClasses($path);
         if (PHP_VERSION_ID >= 70000) {
             // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
             gc_mem_caches();
         }
         foreach ($classes as $class) {
             $map[$class] = $path;
         }
     }
     return $map;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:32,代码来源:ClassMapGenerator.php


示例2: extract

 /**
  * {@inheritdoc}
  */
 public function extract($resource, MessageCatalogue $catalog)
 {
     $files = $this->extractFiles($resource);
     foreach ($files as $file) {
         $this->parseTokens(token_get_all(file_get_contents($file)), $catalog);
         if (PHP_VERSION_ID >= 70000) {
             // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
             gc_mem_caches();
         }
     }
 }
开发者ID:unexge,项目名称:symfony,代码行数:14,代码来源:PhpExtractor.php


示例3: load

 /**
  * Loads from annotations from a file.
  *
  * @param string      $file A PHP file path
  * @param string|null $type The resource type
  *
  * @return RouteCollection A RouteCollection instance
  *
  * @throws \InvalidArgumentException When the file does not exist or its routes cannot be parsed
  */
 public function load($file, $type = null)
 {
     $path = $this->locator->locate($file);
     $collection = new RouteCollection();
     if ($class = $this->findClass($path)) {
         $collection->addResource(new FileResource($path));
         $collection->addCollection($this->loader->load($class, $type));
     }
     if (PHP_VERSION_ID >= 70000) {
         // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
         gc_mem_caches();
     }
     return $collection;
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:24,代码来源:AnnotationFileLoader.php


示例4: stripComments

 /**
  * Removes comments from a PHP source string.
  *
  * We don't use the PHP php_strip_whitespace() function
  * as we want the content to be readable and well-formatted.
  *
  * @param string $source A PHP string
  *
  * @return string The PHP string with the comments removed
  */
 public static function stripComments($source)
 {
     if (!function_exists('token_get_all')) {
         return $source;
     }
     $rawChunk = '';
     $output = '';
     $tokens = token_get_all($source);
     $ignoreSpace = false;
     for ($i = 0; isset($tokens[$i]); ++$i) {
         $token = $tokens[$i];
         if (!isset($token[1]) || 'b"' === $token) {
             $rawChunk .= $token;
         } elseif (T_START_HEREDOC === $token[0]) {
             $output .= $rawChunk . $token[1];
             do {
                 $token = $tokens[++$i];
                 $output .= isset($token[1]) && 'b"' !== $token ? $token[1] : $token;
             } while ($token[0] !== T_END_HEREDOC);
             $rawChunk = '';
         } elseif (T_WHITESPACE === $token[0]) {
             if ($ignoreSpace) {
                 $ignoreSpace = false;
                 continue;
             }
             // replace multiple new lines with a single newline
             $rawChunk .= preg_replace(array('/\\n{2,}/S'), "\n", $token[1]);
         } elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
             $ignoreSpace = true;
         } else {
             $rawChunk .= $token[1];
             // The PHP-open tag already has a new-line
             if (T_OPEN_TAG === $token[0]) {
                 $ignoreSpace = true;
             }
         }
     }
     $output .= $rawChunk;
     if (PHP_VERSION_ID >= 70000) {
         // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
         unset($tokens, $rawChunk);
         gc_mem_caches();
     }
     return $output;
 }
开发者ID:gpichurov,项目名称:ittalents_season5,代码行数:55,代码来源:Kernel.php


示例5: fixNamespaceDeclarations

 /**
  * Adds brackets around each namespace if it's not already the case.
  *
  * @param string $source Namespace string
  *
  * @return string Namespaces with brackets
  */
 public static function fixNamespaceDeclarations($source)
 {
     if (!function_exists('token_get_all') || !self::$useTokenizer) {
         if (preg_match('/(^|\\s)namespace(.*?)\\s*;/', $source)) {
             $source = preg_replace('/(^|\\s)namespace(.*?)\\s*;/', "\$1namespace\$2\n{", $source) . "}\n";
         }
         return $source;
     }
     $rawChunk = '';
     $output = '';
     $inNamespace = false;
     $tokens = token_get_all($source);
     for ($i = 0; isset($tokens[$i]); ++$i) {
         $token = $tokens[$i];
         if (!isset($token[1]) || 'b"' === $token) {
             $rawChunk .= $token;
         } elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) {
             // strip comments
             continue;
         } elseif (T_NAMESPACE === $token[0]) {
             if ($inNamespace) {
                 $rawChunk .= "}\n";
             }
             $rawChunk .= $token[1];
             // namespace name and whitespaces
             while (isset($tokens[++$i][1]) && in_array($tokens[$i][0], array(T_WHITESPACE, T_NS_SEPARATOR, T_STRING))) {
                 $rawChunk .= $tokens[$i][1];
             }
             if ('{' === $tokens[$i]) {
                 $inNamespace = false;
                 --$i;
             } else {
                 $rawChunk = rtrim($rawChunk) . "\n{";
                 $inNamespace = true;
             }
         } elseif (T_START_HEREDOC === $token[0]) {
             $output .= self::compressCode($rawChunk) . $token[1];
             do {
                 $token = $tokens[++$i];
                 $output .= isset($token[1]) && 'b"' !== $token ? $token[1] : $token;
             } while ($token[0] !== T_END_HEREDOC);
             $output .= "\n";
             $rawChunk = '';
         } elseif (T_CONSTANT_ENCAPSED_STRING === $token[0]) {
             $output .= self::compressCode($rawChunk) . $token[1];
             $rawChunk = '';
         } else {
             $rawChunk .= $token[1];
         }
     }
     if ($inNamespace) {
         $rawChunk .= "}\n";
     }
     $output .= self::compressCode($rawChunk);
     if (PHP_VERSION_ID >= 70000) {
         // PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
         unset($tokens, $rawChunk);
         gc_mem_caches();
     }
     return $output;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:68,代码来源:ClassCollectionLoader.php


示例6: var_dump

<?php

var_dump(gc_mem_caches());
开发者ID:ezoic,项目名称:hhvm,代码行数:3,代码来源:gc_mem_caches.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP gcd函数代码示例发布时间:2022-05-15
下一篇:
PHP gc_enabled函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap