我想从 S3 提供我的静态/媒体内容(现在是图像),但我的 url 应该是现在的样子。例如:
http://example.com/resources/img/me.jpg 是我当前的图像 url 之一,它现在由本机服务器提供(EBS 存储随 EC2 一起提供)。现在我想将这个 me.jpg 文件存储在一个 s3 存储桶中,然后如果有人输入上面的 url,它就会从那里带来。
我知道这可以通过创建一个存储桶名称作为 example.com 和 www.example.com,然后为s3-website-region.amazonaws.com配置 Route 53 CNAME(别名)
但是当我输入http://example.com/blog/cool-stuff-blog时会发生什么?这不适用于静态/媒体内容!它需要执行服务器端代码(Python/PHP)。
但是使用我当前工作域的上述配置会发生什么?它不会尝试从 S3 提供一些内容并失败吗?
我怎样才能完成它?请不要说有一个像 static.example.com 这样的子域,并为所有静态文件请求提供服务。对我来说,这现在是不可接受的。我想使用完全相同的域名。
我希望能够在CFML/LUCEE组件中动态编写一组getter和setter(没有硬编码的cfproperty标签).
<!--- MyComp.cfc --->
<cfcomponent displayname="MyComp" hint="MyComp" accessors="true">
<cffunction name="init">
<cfargument name="dynamicprops" type="array">
<cfloop array="#dynamicprops#" index="item">
<!---
Now what? I cannot do a cfsavecontent and write props here.
It demands cfproperty just after the cfcomponent begins. I
tried to do with closures but they are not acually setters
and getters. Does anyone know how to better do it?
--->
</cfloop>
</cffunction>
</cfcomponent>
<!--- example call --->
<cfset mc = CreateObject("component","MyComp").init( [{"name"="a","default"=1}] ) />
Run Code Online (Sandbox Code Playgroud)
然后我希望能够调用mc.setA(100)和mc.getA().但是没有发生. …
$ gzip file.txt | aws s3 cp file.txt.gz s3://my_bucket/
Run Code Online (Sandbox Code Playgroud)
我正在尝试将file.txt gzip到file.txt.gz并将其传递给aws程序,该程序将s3作为命令而cp作为子命令.
生成:警告:正在跳过文件file.txt.gz. 文件不存在.
我是linux的新手.有人可以帮忙吗?
请看下面的代码块:
<cfset index = 0 />
<cfloop collection="#anotherPerson#" item="key" >
<cfset index = index+1 />
<cfoutput>
#key# : #anotherPerson[key]#
<cfif index lt ArrayLen(structKeyArray(anotherPerson))> , </cfif>
</cfoutput>
</cfloop>
<!--- Result
age : 24 , haar : Blondes haar , sex : female , ort : Hanau
---->
Run Code Online (Sandbox Code Playgroud)
现在,请您告诉我如何在不设置索引并在循环内递增的情况下实现相同的结果?如果你仔细注意,我不得不再写两个cfset标签和一个带有昂贵代码的cfif标签,以避免在集合末尾出现逗号(,)!
amazon-ec2 ×2
amazon-s3 ×2
coldfusion ×2
cfc ×1
cfml ×1
coldfusion-9 ×1
cp ×1
gzip ×1
linux ×1
lucee ×1
php ×1