出现这个错误消息,有什么建议吗?

允许内存大小为33554432字节已耗尽(已尝试分配 43148176字节)的PHP


当前回答

如果你正在使用Laravel,那么可以使用以下方法:

public function getClientsListApi(Request $request){
      print_r($request->all()); //for all request
      print_r($request->name); //for all name 
}

而不是

public function getClientsListApi(Request $request){
      print_r($request); // it show error as above mention
}

其他回答

It is unfortunately easy to program in PHP in a way that consumes memory faster than you realise. Copying strings, arrays and objects instead of using references will do it, though PHP 5 is supposed to do this more automatically than in PHP 4. But dealing with your data set in entirety over several steps is also wasteful compared to processing the smallest logical unit at a time. The classic example is working with large resultsets from a database: most programmers fetch the entire resultset into an array and then loop over it one or more times with foreach(). It is much more memory efficient to use a while() loop to fetch and process one row at a time. The same thing applies to processing a file.

我没有更新主机,数据库是只读的。Joomla需要编写会话,但无法完成。

如果使用共享主机,则不能强制增加php大小限制。

只要去你的cpanel和升级你的php版本到7.1以上,然后你就可以去了。

我有同样的问题,在命令行运行php。最近,我更改了php.ini文件,在更改php.ini时犯了一个错误

这是针对php7.0的

到php.ini的路径:/etc/php/7.0/cli/php.ini

我设置了memory_limit = 256(这意味着256字节),而不是memory_limit = 256M(这意味着256兆字节)。

; 脚本可能消耗的最大内存(128MB) ; http://php.net/memory-limit memory_limit = 128M

一旦我纠正了它,我的过程开始正常运行。

ini_set (memory_limit’,‘- 1);

在你的index.php中,在PHP标签打开后的顶部