首页 \ 问答 \ file_get_contents()使用的内存是否在未分配给变量时被释放?(Does the memory used by file_get_contents() get released when it is not assigned to a variable?)

file_get_contents()使用的内存是否在未分配给变量时被释放?(Does the memory used by file_get_contents() get released when it is not assigned to a variable?)

当我使用file_get_contents并将其作为参数传递给另一个函数时,如果不将其分配给变量,那么在脚本执行完成之前是否释放该内存?

例如:

preg_match($pattern, file_get_contents('http://domain.tld/path/to/file.ext'), $matches);

在脚本完成之前,会释放file_get_contents使用的内存吗?


When I use file_get_contents and pass it as a parameter to another function, without assigning it to a variable, does that memory get released before the script execution finishes?

For Example:

preg_match($pattern, file_get_contents('http://domain.tld/path/to/file.ext'), $matches);

Will the memory used by file_get_contents be released before the script finishes?


原文:https://stackoverflow.com/questions/503322
更新时间:2023-04-25 13:04

最满意答案

当然有办法做到这一点,你需要为它编写一个脚本。

要准备数据,您可以在该字段上执行“替换字段内容”,并用段落符号替换所有空格。 这将使您能够使用FileMaker的值函数来提取值。

该脚本应该包含一个外部循环,循环遍历所找到的一组记录。 记录应该排序,以便新记录按顺序插入,而不是在找到的集合的末尾。

对于每条记录,使用Valuecount函数检查相关字段的值数量。

如果有多个值,则抓取变量中的字段内容并循环访问值,为每次迭代复制记录,使用Getvalue函数将该字段替换为变量中的当前值索引。 在循环结尾减少值索引。

请记住有循环的退出条件,并且在执行此类操作时始终在备份上工作。


This was a bit of a workaround, but I eventually found a much easier solution by exporting the Box_id and Contents fields to Excel and running the following VBA code:

Sub SliceNDice()
Dim objRegex As Object
Dim X
Dim Y
Dim lngRow As Long
Dim lngCnt As Long
Dim tempArr() As String
Dim strArr
Set objRegex = CreateObject("vbscript.regexp")
objRegex.Pattern = "^\s+(.+?)$"
 'Define the range to be analysed
X = Range([a1], Cells(Rows.Count, "b").End(xlUp)).Value2
ReDim Y(1 To 2, 1 To 1000)
For lngRow = 1 To UBound(X, 1)
     'Split each string by ","
    tempArr = Split(X(lngRow, 2), " ")
    For Each strArr In tempArr
        lngCnt = lngCnt + 1
         'Add another 1000 records to resorted array every 1000 records
        If lngCnt Mod 1000 = 0 Then ReDim Preserve Y(1 To 2, 1 To lngCnt + 1000)
        Y(1, lngCnt) = X(lngRow, 1)
        Y(2, lngCnt) = objRegex.Replace(strArr, "$1")
    Next
Next lngRow
 'Dump the re-ordered range to columns C:D
[c1].Resize(lngCnt, 2).Value2 = Application.Transpose(Y)
End Sub

This solution was modified from this previous question.

相关问答

更多
  • 听起来你删除了一些字段。 如果您只是重命名字段,那么脚本应该仍然有效,除非您彻底更改了数据(可能脚本正在对应该包含某些特定类型的字段进行查找,该字段不再在字段中设置...)转到布局模式,找出按钮调用的脚本,然后打开脚本并重新设置调用缺少字段的任何设置字段步骤,你应该好好去。 It sounds like you deleted some fields. If you simply renamed fields then the scripts should still work, unless you ch ...
  • 按要求回答你的问题: 您可以通过计算验证Bar字段(或任何其他字段): not IsEmpty ( TableB::Foo ) 设置验证以验证Always 。 如果您尝试在TableA中提交记录而没有TableB中的相关记录,则会抛出验证错误。 要根据其他字段中的值自动完成,您必须使用值列表将目标字段格式化为具有自动完成功能的下拉列表。 在定义值列表之前,请将新关系(使用新出现的TableB)设置为: TableA::Foo = TableB 2::Foo 然后定义值列表以使用TableB 2 ...
  • 一种可能的解决方法是使用PHP函数将文件编码为base 64,并将该值设置为FileMaker中的文本字段。 在那里,您可以使用自动输入或脚本来获取基数64值并将其解码为容器字段。 这适用于文件较小的文件。 A possible workaround is to use PHP functions to encode the file to base 64 and set that value to a text field in FileMaker. Once there, you can have au ...
  • 当然有办法做到这一点,你需要为它编写一个脚本。 要准备数据,您可以在该字段上执行“替换字段内容”,并用段落符号替换所有空格。 这将使您能够使用FileMaker的值函数来提取值。 该脚本应该包含一个外部循环,循环遍历所找到的一组记录。 记录应该排序,以便新记录按顺序插入,而不是在找到的集合的末尾。 对于每条记录,使用Valuecount函数检查相关字段的值数量。 如果有多个值,则抓取变量中的字段内容并循环访问值,为每次迭代复制记录,使用Getvalue函数将该字段替换为变量中的当前值索引。 在循环结尾减少值 ...
  • FileMaker布局是静态的,但您仍可以根据字段值更改布局: 计算字段 如果要更改区域中显示的数据,可以使用“计算”字段。 一个典型的例子是状态字段。 要执行此操作,您需要在表中添加一个新字段,然后在该字段中输入计算,如: Case ( IsEmpty(myTable::myField) ; "Please enter a value for myField." ; myTable::myField = "wrong value" ; "Please enter a correct v ...
  • FileMaker始终主要是最终用户工具,因此其所有脚本更像是重复用户操作的宏。 它远不如面向程序员的环境那么灵活。 实际上,转到另一个布局是操纵相关值的标准方法。 如果您想要复制相关记录或打印报告,则无论如何都必须这样做。 所以: 除了可以使用“替换字段内容”脚本步骤之外,您的脚本非常好。 还要在开头添加Freeze Window脚本步骤; 它会阻止屏幕更新。 如果您有相关表的门户,则可以遍历门户行。 FileMaker插件API可以执行SQL,并且有一些插件可以公开此功能。 所以,如果你真的想要,这也是 ...
  • 恕我直言,最好使用两个表,比如标题和范例,它们之间有一对多的关系。 封面照片将存储在标题中的字段中,并且所有子样本都可以显示它而无需您复制它。 这假设你有一些独特的东西来记录每个样本 - 否则你可以在标题表中只有一个数量字段。 IMHO, it would be much better to use two tables, say Titles and Exemplars, with a one-to-many relationship between them. The cover photo would ...
  • 我无法弄清楚如何使用布尔值设置Meal 一种简单的方法是使用值为1的值列表。 然后将“膳食”字段设置为“数字”字段,将其格式化为复选框,并使其足够窄,以便用户看不到1 。 有了这个,你就可以制定你的隐藏条件而not Meal 。 根据您当前的安排,如果Meal是一个格式为Yes / No单选按钮设置的Text字段,您可以使用Meal ≠ "Yes"作为隐藏公式。 当“膳食”字段为空或包含"No"时,这将隐藏甜点字段。 I can't figure out how to set Meal with Boole ...
  • 名字: Left ( Attendance::UserID ; Position(Attendance::UserID; "."; 1; 1)-1 ) 姓氏: Right( Attendance::UserID; Length(Attendance::UserID) - Position(Attendance::UserID; "."; 1; 1) ) For first name: Left ( Attendance::UserID ; Position(Attendance::UserID; "." ...
  • 您只需要使用FileMaker PHP API中记录的setField方法(这里是FileMaker_Record类文档的页面),然后使用commit提交您的记录: ... $record->setField('d15', 'new value'); $record->commit(); ... You just need to use the setField method as documented in the FileMaker PHP API (here's the page for the d ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)