我正在将整个网站从Coldfusion转换为PHP.所以,期待很多像这样的问题.如何用PHP编写:
<cfif cgi.script_name contains "newsletter">
Run Code Online (Sandbox Code Playgroud) 我正在开发一个Coldfusion页面,它从表单中获取信息并发回到同一页面.但是,我有一个CFHTTP URL字符串,我想要POST到一个PHP页面,我也希望在一个单独的页面中打开(仍然保持原始的POST页面打开.我认为CFHTTP将接受"目标 - 空白"值,但它没有.这是我的代码:
<cfhttp method="Post" url="https://www.foo.com/foocorp/restrict/fpdf/letter.php" result="adverseResponse">
<cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0">
<cfhttpparam type="Header" name="TE" value="deflate;q=0">
<cfoutput>
<cfif isdefined( "b_firstname" )><cfhttpparam name="B_FIRSTNAME" type="formField" value="#B_FIRSTNAME#"></cfif>
<cfif isdefined( "b_lastname" )><cfhttpparam name="B_LASTNAME" type="formField" value="#B_LASTNAME#"></cfif>
<cfif isdefined( "prop_address" )><cfhttpparam name="PROP_ADDRESS" type="formField" value="#PROP_ADDRESS#"></cfif>
<cfif isdefined( "prop_city" )><cfhttpparam name="PROP_CITY" type="formField" value="#PROP_CITY#"></cfif>
<cfif isdefined( "prop_state" )><cfhttpparam name="PROP_STATE" type="formField" value="#PROP_STATE#"></cfif>
<cfif isdefined( "prop_zip" )><cfhttpparam name="PROP_ZIP" type="formField" value="#PROP_ZIP#"></cfif>
</cfoutput>
</cfhttp>
Run Code Online (Sandbox Code Playgroud)
我应该使用另一个CF元素而不是CFHTTP吗?
在coldfusion中,在表单的隐藏值中,我得到两个值:
<input type="hidden" name="EST_VAL" value="#EST_VAL#" />
<input type="hidden" name="DOWN_PMT" value="#DOWN_PMT#" />
Run Code Online (Sandbox Code Playgroud)
我需要从DOWN_PMT中找到减去EST_VAL的值并将其赋值给该值:
<input type="hidden" name="LOAN_VAL" value="#LOAN_VAL#" />
Run Code Online (Sandbox Code Playgroud)
我知道如何在PHP中执行此操作,但我不确定是否应该在coldfusion中使用cfset或cffunction.