【问题标题】:Need help changing file size allowed to upload on attachment form需要帮助更改允许在附件表单上上传的文件大小
【发布时间】:2017-03-08 04:52:37
【问题描述】:

当我尝试将文件附加到我的上传表单时,它给了我这个错误:

致命错误:1238行/home/content/j/o/h/johnmunro/html/upload/include/class.phpmailer.php中允许的内存大小为67108864字节已用尽(试图分配26990378字节)

这里是 1238 上明显导致此问题的代码行。谁能帮帮我。

 /**
* Encodes string to requested format. Returns an
* empty string on failure.
* @access private
* @return string
*/
function EncodeString ($str, $encoding = 'base64') {
$encoded = '';
switch(strtolower($encoding)) {
  case 'base64':
    /* chunk_split is found in PHP >= 3.0.6 */
    $encoded = chunk_split(base64_encode($str), 76, $this->LE);
    break;
  case '7bit':
  case '8bit':
    $encoded = $this->FixEOL($str);
    if (substr($encoded, -(strlen($this->LE))) != $this->LE)
      $encoded .= $this->LE;
    break;
  case 'binary':
    $encoded = $str;
    break;
  case 'quoted-printable':
    $encoded = $this->EncodeQP($str);
    break;
  default:
    $this->SetError($this->Lang('encoding') . $encoding);
    break;
}
return $encoded;

}

【问题讨论】:

    标签: php forms attachment email-attachments


    【解决方案1】:

    该错误表示php需要更多内存才能运行。

    要增加分配给 php 的内存大小,您必须调用: ini_set('memory_limit', '256M'); 在脚本的开头(最好)。 将 256 替换为您需要的内存量。

    更新

    您还应该研究内存优化技术,以便 php 不需要大量内存来执行。

    请通过:

    防止内存耗尽的提示:http://v1.srcnix.com/2010/02/10/7-tips-to-prevent-php-running-out-of-memory/

    PHP 内存和性能手册: http://php.net/manual/en/features.gc.performance-considerations.php

    【讨论】:

    • 那么一小段代码应该可以解决我的问题吗?没有必要做其他事情吗?我需要你提供的链接以防万一我需要更多?
    • 由于某种原因它给了我这个错误:解析错误:语法错误,/home/content/j/o/h/johnmunro/html/upload/include/fgcontactform.php中的意外':'在第 30 行
    • 请分享错误详情。即消息代码等
    猜你喜欢
    • 1970-01-01
    • 2011-10-21
    • 2015-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多