我需要操纵cfhttp.filecontent我从一个get得到的每一行:遍历CFHTTP filecontent
<cfhttp url="www.internet.com/file.html" method="GET" resolveurl="false"></cfhttp>
<cfoutput>
#cfhttp.FileContent#
</cfoutput>
我将如何通过线cfhttp.filecontent线循环?
谢谢!
我需要操纵cfhttp.filecontent我从一个get得到的每一行:遍历CFHTTP filecontent
<cfhttp url="www.internet.com/file.html" method="GET" resolveurl="false"></cfhttp>
<cfoutput>
#cfhttp.FileContent#
</cfoutput>
我将如何通过线cfhttp.filecontent线循环?
谢谢!
通常,您可以将chr(10)和/或chr(13)的某些组合作为列表分隔符使用列表函数。但这一切都取决于您的内容中如何定义“行”。
<cfoutput>
<cfloop list="#cfhttp.FileContent#" delimiters="#chr(10)#" index="line">
#line#<br>
</cfloop>
</cfoutput>
另一种选择(如果你使用的ColdFusion 9)就是写CFHTTP
要求磁盘上的文件的内容,然后通过行使用file
attribute of cfloop
遍历文件中的行。
很好,谢谢! – tylercomp
嗯,会'\ n'工作?我不知道... – Henry
嗯..你尝试过吗? – Leigh