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
最满意答案
当然有办法做到这一点,你需要为它编写一个脚本。
要准备数据,您可以在该字段上执行“替换字段内容”,并用段落符号替换所有空格。 这将使您能够使用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)(Split record based on delimited field, duplicating other fields (Filemaker))[2023-08-04]
当然有办法做到这一点,你需要为它编写一个脚本。 要准备数据,您可以在该字段上执行“替换字段内容”,并用段落符号替换所有空格。 这将使您能够使用FileMaker的值函数来提取值。 该脚本应该包含一个外部循环,循环遍历所找到的一组记录。 记录应该排序,以便新记录按顺序插入,而不是在找到的集合的末尾。 对于每条记录,使用Valuecount函数检查相关字段的值数量。 如果有多个值,则抓取变量中的字段内容并循环访问值,为每次迭代复制记录,使用Getvalue函数将该字段替换为变量中的当前值索引。 在循环结尾减少值 ... -
Filemaker中的动态布局(Dynamic Layouts in Filemaker)[2023-05-13]
FileMaker布局是静态的,但您仍可以根据字段值更改布局: 计算字段 如果要更改区域中显示的数据,可以使用“计算”字段。 一个典型的例子是状态字段。 要执行此操作,您需要在表中添加一个新字段,然后在该字段中输入计算,如: Case ( IsEmpty(myTable::myField) ; "Please enter a value for myField." ; myTable::myField = "wrong value" ; "Please enter a correct v ... -
Filemaker:在每个相关记录中设置特定字段的最佳方式(Filemaker: Best way to set a certain field in every related record)[2023-04-19]
FileMaker始终主要是最终用户工具,因此其所有脚本更像是重复用户操作的宏。 它远不如面向程序员的环境那么灵活。 实际上,转到另一个布局是操纵相关值的标准方法。 如果您想要复制相关记录或打印报告,则无论如何都必须这样做。 所以: 除了可以使用“替换字段内容”脚本步骤之外,您的脚本非常好。 还要在开头添加Freeze Window脚本步骤; 它会阻止屏幕更新。 如果您有相关表的门户,则可以遍历门户行。 FileMaker插件API可以执行SQL,并且有一些插件可以公开此功能。 所以,如果你真的想要,这也是 ... -
FileMaker Pro 13:文本字段和容器字段之间的关系(FileMaker Pro 13: Relationship between a text field and a container field)[2022-05-28]
恕我直言,最好使用两个表,比如标题和范例,它们之间有一对多的关系。 封面照片将存储在标题中的字段中,并且所有子样本都可以显示它而无需您复制它。 这假设你有一些独特的东西来记录每个样本 - 否则你可以在标题表中只有一个数量字段。 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 ...
-
在FileMaker中分割文本(Splitting text in FileMaker)[2022-05-20]
名字: 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(Filemaker via PHP)[2023-10-08]
您只需要使用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 ...