search
Homephp教程php手册ThinkPHP提示错误Fatal error: Allowed memory size的解决方法,thinkphpfatal

ThinkPHP提示错误Fatal error: Allowed memory size的解决方法,thinkphpfatal

本文实例讲述了ThinkPHP提示错误Fatal error: Allowed memory size的解决方法。分享给大家供大家参考。具体分析如下:

如果你的ThinkPHP提示你:致命错误(Fatal error: Allowed memory size),根据网上说的提高服务器可使用内存,我觉得都不是好的解决办法。麻烦也没必要。因为这是ThinkPHP本身存在BUG。

错误提示:Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 523800 bytes) in  /var/www/www.example.com/ThinkPHP/Lib/Template/ThinkTemplate.class.php on line 265。

如果你的错误提示跟我的一样,也是告诉你ThinkTemplate.class.php这个文件中出错,那就是它在解析自己的标签include或其他标签时出现了死循环,导致服务器内存不够这个死循环用。

解决方法:

1、找到问题源。在出现错误(Fatal error: Allowed memory size)的模版页中,找到你使用到的ThinkPHP的标签(include/if/empty等),逐个删除测试,看是哪个标签造成的;

2、将你使用的这种标签换成原生的PHP,如:

复制代码 代码如下:




include './Public/home/js/Company/companyJS.html';

如果是因为empty,可以参照上面:

复制代码 代码如下:


if(empty($a)){
    echo 'a为空'
}


至此问题解决!

希望本文所述对大家基于ThinkPHP框架的程序设计有所帮助。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools