Table of Contents
ThinkPHP提示错误Fatal error: Allowed memory size的解决方法,thinkphpfatal
Home php教程 php手册 ThinkPHP提示错误Fatal error: Allowed memory size的解决方法,thinkphpfatal

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

Jun 13, 2016 am 09:14 AM
thinkphp Solution mistake

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 of this Website
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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the permissions problem encountered when viewing Python version in Linux terminal? How to solve the permissions problem encountered when viewing Python version in Linux terminal? Apr 01, 2025 pm 05:09 PM

Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

How to avoid being detected by the browser when using Fiddler Everywhere for man-in-the-middle reading? How to avoid being detected by the browser when using Fiddler Everywhere for man-in-the-middle reading? Apr 02, 2025 am 07:15 AM

How to avoid being detected when using FiddlerEverywhere for man-in-the-middle readings When you use FiddlerEverywhere...

Python 3.6 loading pickle file error ModuleNotFoundError: What should I do if I load pickle file '__builtin__'? Python 3.6 loading pickle file error ModuleNotFoundError: What should I do if I load pickle file '__builtin__'? Apr 02, 2025 am 06:27 AM

Loading pickle file in Python 3.6 environment error: ModuleNotFoundError:Nomodulenamed...

The Python subprocess module fails to execute the wmic datafile command. How to solve it? The Python subprocess module fails to execute the wmic datafile command. How to solve it? Apr 01, 2025 pm 08:48 PM

Use Python's subprocess module to execute wmic...

Why do I get ValueError: too many values ​​to unpack (expected 2) error when using pyecharts' Map? How to solve this problem? Why do I get ValueError: too many values ​​to unpack (expected 2) error when using pyecharts' Map? How to solve this problem? Apr 01, 2025 pm 07:42 PM

The reason and solution to the valueError:toomyvalueestounpack(expected2) error when using pyecharts' Map...

What should I do if the '__builtin__' module is not found when loading the Pickle file in Python 3.6? What should I do if the '__builtin__' module is not found when loading the Pickle file in Python 3.6? Apr 02, 2025 am 07:12 AM

Error loading Pickle file in Python 3.6 environment: ModuleNotFoundError:Nomodulenamed...

How to efficiently read Windows system logs and get only information from the last few days? How to efficiently read Windows system logs and get only information from the last few days? Apr 01, 2025 pm 11:21 PM

Efficient reading of Windows system logs: Reversely traverse Evtx files When using Python to process Windows system log files (.evtx), direct reading will be from the earliest...

See all articles