- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我有 index.php
和几个级联包含的文件,类似这样。
index.php -> controller.php -> model.php -> view.php
在 model.php
我有一个函数使用 ini_set('memory_limit', '-1');
ini_set()
什么时候发布?更改设置过期了吗?
执行后index.php
?还是view.php
?还是model.php
中的函数?
最佳答案
ini_set()
是 global 对于脚本中发生的所有事情(不仅仅是当前文件:正在发生的整个执行线程),对于整个脚本要求;无论您从何处调用它,它都会始终影响此脚本的全局 设置。当您的脚本终止时,效果将过期 - 例如通过exit
,die
,或者跑到index.php
的末尾。
不会影响任何其他同时运行的脚本(需要自己调用ini_set
),也不会持久化到后面的请求中(如果需要持久化设置,需要编辑 php.ini
).
请注意 documentation says the same thing :
Sets the value of the given configuration option. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending.
编辑:由于显然不清楚:您使用 ini_set
更改的值将对整个脚本有效。当前执行在哪里并不重要(在什么文件中,在什么类中,在什么函数中);设置将是相同的,无处不在。它将保持不变,直到您再次更改它,或者直到整个脚本终止。 (不是当前文件,不是当前函数;整个脚本)
关于php - ini_set() 作用范围?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6490955/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!