특정 파일 인 email_output.cfm에 cfmail 함수를 설정했습니다.이 파일은 email_output.cfm? ID = 1과 같이 제대로 작동하려면 ID가 전달되어야합니다. 전달하는 데 필요한 다양한 ID를 반환하는 쿼리를 통해 실행되는 크론 작업을 설정하고 싶습니다. 테스트에서 다음을 수행 할 수 있습니다.
<cflocation url="email_output.cfm?ID=10" >
그러나 cflocation은 다른 모든 실행을 중지하고 다른 페이지를 열기 때문에 반복 할 수 없습니다. 쿼리에서 단일 CF 페이지로 여러 번 매개 변수를 전달하려면 어떻게해야합니까?
감사합니다-조
이것의 사용자 정의 태그 샘플 구현 ...
사용자 정의 태그를 처음 사용하는 경우 태그를 호출하는 페이지와 동일한 폴더에 태그를 넣는 것이 가장 쉽습니다. 다른 디렉토리에 넣는 몇 가지 옵션이 있지만 간단하게 시작하겠습니다.
EmailMembers.cfm
<cfquery name="GetUIDs">
select userid from users
</cfquery>
<cfoutput query="GetUIDs">
<cf_maileach uid="#userID#">
</cfoutput>
내 태그를 cf_maileach라고 부르는 방법을 아십니까?
같은 디렉토리에 maileach.cfm을 배치합니다. 이름이 어떻게 일치하는지 확인하십시오.
maileach.cfm
<cfif StructKeyExists(attributes,"uid") and val(attributes.uid) gt 0>
<cfquery name="getinfo">
select fname,lname,email
from users
where userID = <cfqueryparam cfsqltype="cf_sql_integer" value="#attributes.uid#">
</cfquery>
<cfmail to="#getinfo.email#" subject="Hi #getinfo.fname#">...</cfmail>
</cfif>
노트
<cfmodule>
<cfqueryparam>
찾아보고, 사용하고, 좋아하세요.편집 : CFHTTP 메서드는 이러한 목적을 달성 할 수 있지만 몇 가지 문제가 있습니다.
다음은이를 직접 테스트하기위한 샘플 코드입니다.
"safe"폴더의 내용 :
Application.cfc
[ blank file, to negate my testing site's actual application.cfc ]
Testrun.cfm
<cfoutput><cfset starttick = GetTickCount()>
<cfloop from="1" to="20" index="i">
<cfhttp url="http://mysamesite.com/safe/http.cfm?u=#i#" method="get" result="test">
#test.filecontent#<br>
</cfloop>
CFHTTP Execution Time: #(GetTickCount() - starttick)#<br><br>
<cfset starttick = GetTickCount()>
<cfloop from="1" to="20" index="i">
<cf_testtag u="#i#"><br>
</cfloop>
CustomTag Execution Time: #(GetTickCount() - starttick)#<br><br>
</cfoutput>
testtag.cfm
<cfoutput>The ID entered was #attributes.u#</cfoutput>
http.cfm
<cfoutput>The ID entered was #url.u#</cfoutput>
결과 (밀리 초) 각 테스트는 HTTP에서 20 번 통과하고 사용자 지정 태그에서 20 번 통과했습니다.
CFHTTP Tag
661ms 6ms
1624 5
616 5
460 4
522 6
816 4
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다