Phpmyadmin PHP致命错误:已耗尽268435456字节的允许内存大小(尝试分配72字节) if(函数_存在('mb_detect_encoding')&&false!=$encoding mb_detect_encoding($params[$index])) { if(self::MAX_STRING_LENGTHstopwatch=$stopwatch; } /** *{@inheritardoc} */ 公共函数startQuery($sql,数组$params=null,数组$types=null) { 如果(空!=$this->stopwatch){ $this->stopwatch->start(‘条令’、‘条令’); } if(is_数组($params)){ foreach($params作为$index=>$param){ 如果(!is_string($params[$index])){ 继续; } //非utf-8字符串中断json编码 如果(!preg_match('#[\p{L}\p{N}]#u',$params[$index])){ $params[$index]=self::二进制数据值; 继续; } //检测是否必须缩短过长的字符串 if(函数_存在('mb_detect_encoding')&&false!=$encoding=mb_detect_encoding($params[$index])){ if(self::MAX_STRING_LENGTHlog($sql,null===$params?array():$params); } } /** *{@inheritardoc} */ 公共函数stopQuery() { 如果(空!=$this->stopwatch){ $this->stopwatch->stop('doctor'); } } /** *记录一条消息。 * *@param string$message要记录的消息 *@param数组$params上下文 */ 受保护的函数日志($message,array$params) { $this->logger->debug($message,$params); } } 听起来你做了一个无限循环。但老实说,我从来没有遇到过这个问题。这还不足以知道什么在使用内存。无限循环是可能的,或者无限数组增长。循环continued在哪里?为什么这个代码片段包含在问题中?在内存耗尽的情况下,代码的一部分可能会耗尽几乎所有的内存,从而导致代码中完全不相关的部分在其他地方中断。这有什么帮助?256M的时候,记忆耗尽了请解释一下,我不明白为什么那样会有帮助 if (function_exists('mb_detect_encoding') && false !== $encoding mb_detect_encoding($params[$index])) { if (self::MAX_STRING_LENGTH < mb_strlen($params[$index], $encoding)) { $params[$index] = mb_substr($params[$index], 0, self::MAX_STRING_LENGTH - 6, $encoding) . ' [...]'; continue; } } else { if (self::MAX_STRING_LENGTH < strlen($params[$index])) { $params[$index] = substr($params[$index], 0, self::MAX_STRING_LENGTH - 6) . ' [...]'; continue; } } ini_set("memory_limit","72M"); /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Logger; use Psr\Log\LoggerInterface; use Symfony\Component\Stopwatch\Stopwatch; use Doctrine\DBAL\Logging\SQLLogger; /** * DbalLogger. * * @author Fabien Potencier <fabien@symfony.com> */ class DbalLogger implements SQLLogger { const MAX_STRING_LENGTH = 32; const BINARY_DATA_VALUE = '(binary value)'; protected $logger; protected $stopwatch; /** * Constructor. * * @param LoggerInterface $logger A LoggerInterface instance * @param Stopwatch $stopwatch A Stopwatch instance */ public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch = null) { $this->logger = $logger; $this->stopwatch = $stopwatch; } /** * {@inheritdoc} */ public function startQuery($sql, array $params = null, array $types = null) { if (null !== $this->stopwatch) { $this->stopwatch->start('doctrine', 'doctrine'); } if (is_array($params)) { foreach ($params as $index => $param) { if (!is_string($params[$index])) { continue; } // non utf-8 strings break json encoding if (!preg_match('#[\p{L}\p{N} ]#u', $params[$index])) { $params[$index] = self::BINARY_DATA_VALUE; continue; } // detect if the too long string must be shorten if (function_exists('mb_detect_encoding') && false !== $encoding = mb_detect_encoding($params[$index])) { if (self::MAX_STRING_LENGTH < mb_strlen($params[$index], $encoding)) { $params[$index] = mb_substr($params[$index], 0, self::MAX_STRING_LENGTH - 6, $encoding).' [...]'; continue; } } else { if (self::MAX_STRING_LENGTH < strlen($params[$index])) { $params[$index] = substr($params[$index], 0, self::MAX_STRING_LENGTH - 6).' [...]'; continue; } } } } if (null !== $this->logger) { $this->log($sql, null === $params ? array() : $params); } } /** * {@inheritdoc} */ public function stopQuery() { if (null !== $this->stopwatch) { $this->stopwatch->stop('doctrine'); } } /** * Logs a message. * * @param string $message A message to log * @param array $params The context */ protected function log($message, array $params) { $this->logger->debug($message, $params); } }

Phpmyadmin PHP致命错误:已耗尽268435456字节的允许内存大小(尝试分配72字节) if(函数_存在('mb_detect_encoding')&&false!=$encoding mb_detect_encoding($params[$index])) { if(self::MAX_STRING_LENGTHstopwatch=$stopwatch; } /** *{@inheritardoc} */ 公共函数startQuery($sql,数组$params=null,数组$types=null) { 如果(空!=$this->stopwatch){ $this->stopwatch->start(‘条令’、‘条令’); } if(is_数组($params)){ foreach($params作为$index=>$param){ 如果(!is_string($params[$index])){ 继续; } //非utf-8字符串中断json编码 如果(!preg_match('#[\p{L}\p{N}]#u',$params[$index])){ $params[$index]=self::二进制数据值; 继续; } //检测是否必须缩短过长的字符串 if(函数_存在('mb_detect_encoding')&&false!=$encoding=mb_detect_encoding($params[$index])){ if(self::MAX_STRING_LENGTHlog($sql,null===$params?array():$params); } } /** *{@inheritardoc} */ 公共函数stopQuery() { 如果(空!=$this->stopwatch){ $this->stopwatch->stop('doctor'); } } /** *记录一条消息。 * *@param string$message要记录的消息 *@param数组$params上下文 */ 受保护的函数日志($message,array$params) { $this->logger->debug($message,$params); } } 听起来你做了一个无限循环。但老实说,我从来没有遇到过这个问题。这还不足以知道什么在使用内存。无限循环是可能的,或者无限数组增长。循环continued在哪里?为什么这个代码片段包含在问题中?在内存耗尽的情况下,代码的一部分可能会耗尽几乎所有的内存,从而导致代码中完全不相关的部分在其他地方中断。这有什么帮助?256M的时候,记忆耗尽了请解释一下,我不明白为什么那样会有帮助 if (function_exists('mb_detect_encoding') && false !== $encoding mb_detect_encoding($params[$index])) { if (self::MAX_STRING_LENGTH < mb_strlen($params[$index], $encoding)) { $params[$index] = mb_substr($params[$index], 0, self::MAX_STRING_LENGTH - 6, $encoding) . ' [...]'; continue; } } else { if (self::MAX_STRING_LENGTH < strlen($params[$index])) { $params[$index] = substr($params[$index], 0, self::MAX_STRING_LENGTH - 6) . ' [...]'; continue; } } ini_set("memory_limit","72M"); /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Doctrine\Logger; use Psr\Log\LoggerInterface; use Symfony\Component\Stopwatch\Stopwatch; use Doctrine\DBAL\Logging\SQLLogger; /** * DbalLogger. * * @author Fabien Potencier <fabien@symfony.com> */ class DbalLogger implements SQLLogger { const MAX_STRING_LENGTH = 32; const BINARY_DATA_VALUE = '(binary value)'; protected $logger; protected $stopwatch; /** * Constructor. * * @param LoggerInterface $logger A LoggerInterface instance * @param Stopwatch $stopwatch A Stopwatch instance */ public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch = null) { $this->logger = $logger; $this->stopwatch = $stopwatch; } /** * {@inheritdoc} */ public function startQuery($sql, array $params = null, array $types = null) { if (null !== $this->stopwatch) { $this->stopwatch->start('doctrine', 'doctrine'); } if (is_array($params)) { foreach ($params as $index => $param) { if (!is_string($params[$index])) { continue; } // non utf-8 strings break json encoding if (!preg_match('#[\p{L}\p{N} ]#u', $params[$index])) { $params[$index] = self::BINARY_DATA_VALUE; continue; } // detect if the too long string must be shorten if (function_exists('mb_detect_encoding') && false !== $encoding = mb_detect_encoding($params[$index])) { if (self::MAX_STRING_LENGTH < mb_strlen($params[$index], $encoding)) { $params[$index] = mb_substr($params[$index], 0, self::MAX_STRING_LENGTH - 6, $encoding).' [...]'; continue; } } else { if (self::MAX_STRING_LENGTH < strlen($params[$index])) { $params[$index] = substr($params[$index], 0, self::MAX_STRING_LENGTH - 6).' [...]'; continue; } } } } if (null !== $this->logger) { $this->log($sql, null === $params ? array() : $params); } } /** * {@inheritdoc} */ public function stopQuery() { if (null !== $this->stopwatch) { $this->stopwatch->stop('doctrine'); } } /** * Logs a message. * * @param string $message A message to log * @param array $params The context */ protected function log($message, array $params) { $this->logger->debug($message, $params); } },phpmyadmin,Phpmyadmin,Hi修改php.ini上的内存限制 内存限制=75M /* *此文件是Symfony软件包的一部分。 * *(c)法比恩效价仪 * *有关完整版权和许可证信息,请查看许可证 *与此源代码一起分发的文件。 */ 名称空间Symfony\Bridge\doctor\Logger; 使用Psr\Log\logger接口; 使用Symfony\Component\Stopwatch\Stopwatch; 使用条令\DBAL\Logging\SQLLogger; /** *德巴洛格。 * *@作者法比恩

Hi修改
php.ini上的内存限制

内存限制=75M

/*
*此文件是Symfony软件包的一部分。
*
*(c)法比恩效价仪
*
*有关完整版权和许可证信息,请查看许可证
*与此源代码一起分发的文件。
*/
名称空间Symfony\Bridge\doctor\Logger;
使用Psr\Log\logger接口;
使用Symfony\Component\Stopwatch\Stopwatch;
使用条令\DBAL\Logging\SQLLogger;
/**
*德巴洛格。
*
*@作者法比恩·普利蒂埃
*/
类DbalLogger实现SQLLogger
{
常量最大字符串长度=32;
常量二进制数据值='(二进制值)';
受保护的数据记录器;
受保护的秒表;
/**
*构造器。
*
*@param LoggerInterface$logger logger LoggerInterface实例
*@param Stopwatch$Stopwatch秒表实例
*/
公共函数构造(LoggerInterface$logger=null,Stopwatch$Stopwatch=null)
{
$this->logger=$logger;
$this->stopwatch=$stopwatch;
}
/**
*{@inheritardoc}
*/
公共函数startQuery($sql,数组$params=null,数组$types=null)
{
如果(空!=$this->stopwatch){
$this->stopwatch->start(‘条令’、‘条令’);
}
if(is_数组($params)){
foreach($params作为$index=>$param){
如果(!is_string($params[$index])){
继续;
}
//非utf-8字符串中断json编码
如果(!preg_match('#[\p{L}\p{N}]#u',$params[$index])){
$params[$index]=self::二进制数据值;
继续;
}
//检测是否必须缩短过长的字符串
if(函数_存在('mb_detect_encoding')&&false!=$encoding=mb_detect_encoding($params[$index])){
if(self::MAX_STRING_LENGTHlogger){
$this->log($sql,null===$params?array():$params);
}
}
/**
*{@inheritardoc}
*/
公共函数stopQuery()
{
如果(空!=$this->stopwatch){
$this->stopwatch->stop('doctor');
}
}
/**
*记录一条消息。
*
*@param string$message要记录的消息
*@param数组$params上下文
*/
受保护的函数日志($message,array$params)
{
$this->logger->debug($message,$params);
}
}

听起来你做了一个无限循环。但老实说,我从来没有遇到过这个问题。这还不足以知道什么在使用内存。无限循环是可能的,或者无限数组增长。循环
continue
d在哪里?为什么这个代码片段包含在问题中?在内存耗尽的情况下,代码的一部分可能会耗尽几乎所有的内存,从而导致代码中完全不相关的部分在其他地方中断。这有什么帮助?256M的时候,记忆耗尽了请解释一下,我不明白为什么那样会有帮助
if (function_exists('mb_detect_encoding') && false !== $encoding mb_detect_encoding($params[$index]))
{
  if (self::MAX_STRING_LENGTH < mb_strlen($params[$index], $encoding))
  {
    $params[$index] = mb_substr($params[$index], 0, self::MAX_STRING_LENGTH - 6, $encoding) . ' [...]';
    continue;
  }
} else {
  if (self::MAX_STRING_LENGTH < strlen($params[$index])) 
  {
      $params[$index] = substr($params[$index], 0, self::MAX_STRING_LENGTH - 6) . ' [...]';
      continue;
  }
}
ini_set("memory_limit","72M");
/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

 namespace Symfony\Bridge\Doctrine\Logger;

use Psr\Log\LoggerInterface;
use Symfony\Component\Stopwatch\Stopwatch;
use Doctrine\DBAL\Logging\SQLLogger;

/**
 * DbalLogger.
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
class DbalLogger implements SQLLogger
{
const MAX_STRING_LENGTH = 32;
const BINARY_DATA_VALUE = '(binary value)';

protected $logger;
protected $stopwatch;

/**
 * Constructor.
 *
 * @param LoggerInterface $logger    A LoggerInterface instance
 * @param Stopwatch       $stopwatch A Stopwatch instance
 */
public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch = null)
{
    $this->logger = $logger;
    $this->stopwatch = $stopwatch;
}

/**
 * {@inheritdoc}
 */
public function startQuery($sql, array $params = null, array $types = null)
{
    if (null !== $this->stopwatch) {
        $this->stopwatch->start('doctrine', 'doctrine');
    }

    if (is_array($params)) {
        foreach ($params as $index => $param) {
            if (!is_string($params[$index])) {
                continue;
            }

            // non utf-8 strings break json encoding
            if (!preg_match('#[\p{L}\p{N} ]#u', $params[$index])) {
                $params[$index] = self::BINARY_DATA_VALUE;
                continue;
            }

            // detect if the too long string must be shorten
            if (function_exists('mb_detect_encoding') && false !== $encoding = mb_detect_encoding($params[$index])) {
                if (self::MAX_STRING_LENGTH < mb_strlen($params[$index], $encoding)) {
                    $params[$index] = mb_substr($params[$index], 0, self::MAX_STRING_LENGTH - 6, $encoding).' [...]';
                    continue;
                }
            } else {
                if (self::MAX_STRING_LENGTH < strlen($params[$index])) {
                    $params[$index] = substr($params[$index], 0, self::MAX_STRING_LENGTH - 6).' [...]';
                    continue;
                }
            }
        }
    }

    if (null !== $this->logger) {
        $this->log($sql, null === $params ? array() : $params);
    }
}

/**
 * {@inheritdoc}
 */
public function stopQuery()
{
    if (null !== $this->stopwatch) {
        $this->stopwatch->stop('doctrine');
    }
}

/**
 * Logs a message.
 *
 * @param string $message A message to log
 * @param array  $params  The context
 */
protected function log($message, array $params)
{
    $this->logger->debug($message, $params);
}
}