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,如:
复制代码 代码如下:
如果是因为empty,可以参照上面:
复制代码 代码如下:
if(empty($a)){
echo 'a为空'
}
至此问题解决!
希望本文所述对大家基于ThinkPHP框架的程序设计有所帮助。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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

Fastapi ...

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

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

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

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

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

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...
