小编Ven*_*eni的帖子

在CF中,我可以使用变量作为名称来调用自定义标签吗?

我想使用名称中的变量来调用自定义标签。像这样

<cfset slist = 'product_categories'>
<cf_cu_show_#slist#>
Run Code Online (Sandbox Code Playgroud)

这给我#上的错误。自定义标签cu_show_product_categories存在,并且以常规方式调用时起作用。这个想法是建立一个循环列表,调用几个自定义标签。

<cfset slist = 'product_categories'>
<cfif a = 'blogs'>
    <cfset slist = listAppend(slist,"blogs")>
</cfif>
<cfif b = 'posts'> 
    <cfset s_list = listAppend(slist,"last_posts")>
</cfif>
<cfloop list="#slist#" index="i">
    <cf_cu_show_#i#>
</cfloop>
Run Code Online (Sandbox Code Playgroud)

我尝试使用Google,但找不到任何有用的东西。任何帮助,将不胜感激。

coldfusion cfml

4
推荐指数
1
解决办法
73
查看次数

在ColdFusion中,是否可以将数组传递给自定义标签?

我想将数组传递给自定义标签。这可能吗?我有一个arry arrayProd。在我的cfm中,我正在调用自定义标签:

<cf_cu_show_productcategories thename="#thename#" thenameprod="#thenameprod#" arrayProd="#arrayProd#">
Run Code Online (Sandbox Code Playgroud)

自定义标签:

<cfparam name="attributes.thename" default="">
<cfparam name="attributes.thenameprod" default="">
<cfparam name="attributes.arrayProd" type="array" default="">
Run Code Online (Sandbox Code Playgroud)

在自定义标签中使用此arrayProd会导致“变量ARRAYPROD未定义”。

arrays coldfusion custom-tags cfml

2
推荐指数
1
解决办法
69
查看次数

在ColdFusion中,是否可以使用计划任务直接将文件上传到amazon s3?

我必须制作一个预定的脚本/cfm,从某个文件位置下载图像(没问题),然后将其上传到我们的亚马逊 s3 位置(有问题)。这可能吗?如果可能的话怎么办?下载正常,文件存储在临时文件夹中。我如何/可以将此文件发送到 Amazon s3?

到目前为止我尝试过:

  1. 下载文件时直接存储在s3上:
<cfhttp method="get" url="#cimage#" path="https://s3-eu-west-1.amazonaws.com/ourfilelocation/" file="#theimage#" />
Run Code Online (Sandbox Code Playgroud)

给我错误“这是只读资源,无法写入”

  1. 首先将其下载到临时文件位置,然后在新的 cfhttp 中上传到 s3 :
<cfhttp method="get" url="#cimage#" path="#tmpfileloc#" file="#theimage#" />
<cfhttp method="post" url="https://s3-eu-west-1.amazonaws.com/ourfilelocation/" path="#tmpfileurl#" file="#theimage#" />
Run Code Online (Sandbox Code Playgroud)

给我错误“405 方法不允许”

3.

<cffile action="upload" file="#tmpfileurl#/#theimage#" destination="https://s3-eu-west-1.amazonaws.com/ourfilelocation/">
Run Code Online (Sandbox Code Playgroud)

这当然给了我“没有使用此表格发送文件”,因为没有表格

4.

<cfhttp method="post" url="https://s3-eu-west1.amazonaws.com/ourfilelocation"> 
<cfhttpparam type="file" name="#theimage#" file="#tmpfileurl#/#theimage#"> </cfhttp>
Run Code Online (Sandbox Code Playgroud)

给我“连接失败”。状态代码不可用。” 我想你不能只发布到该网址,这没有意义。但我不知道是否有办法可以做到。

coldfusion amazon-s3 coldfusion-2016

2
推荐指数
1
解决办法
565
查看次数