我在Railo服务器上注意到的奇怪之处.+我在网址中传递的所有字符都会在我cfdump或cfoutput它们时自动转换为空格.
是否要更改任何服务器设置以+保持a +?
我根本没有cURL的经验,但从我可以收集到的,它相当于cfhttp.
我想使用Instagram API并验证用户身份.他们的例子使用cURL.
curl \-F 'client_id=CLIENT-ID' \
-F 'client_secret=CLIENT-SECRET' \
-F 'grant_type=authorization_code' \
-F 'redirect_uri=YOUR-REDIRECT-URI' \
-F 'code=CODE' \https://api.instagram.com/oauth/access_token
Run Code Online (Sandbox Code Playgroud)
我认为CF版本会是正确的吗?
<cfhttp url="https://api.instagram.com/oauth/access_token" method="post" resolveurl="true">
<cfhttpparam type="formField" name="client_id" value="CLIENT-ID" />
<cfhttpparam type="formField" name="client_secret" value="CLIENT-SECRET" />
<cfhttpparam type="formField" name="grant_type" value="authorization_code" />
<cfhttpparam type="formField" name="redirect_uri" value="YOUR-REDIRECT-URI" />
<cfhttpparam type="formField" name="code" value="code" />
</cfhttp>
Run Code Online (Sandbox Code Playgroud)
我无法尝试这一点,因为直到很久以后我才会在我的开发机器上,所以我现在只是在寻找可能性并制作伪代码(未经过测试!).
任何具有Instagram API和ColdFusion经验的人都可以获得一些见解,我们将不胜感激.
我正在使用Railo.
我遇到问题,我的ColdFusion代码返回"元素AUTHOR在FORM中未定义".每当我提交表格时 我已经尝试使用<cfparam>设置,comment.author但它也没有用.我对ColdFusion很新,所以任何推理评论都会很棒!
<cfparam name="form.submitted" default="0" />
<cfset blogPost = EntityLoad('BlogPost',url.id,true) />
<cfif form.submitted>
<cfset comment = EntityNew('BlogComment') />
<cfset comment.author = form.author />
<cfset comment.comment = form.comment />
<cfset comment.createdDateTime = now() />
<cfset blogPost.addComment(comment) />
<cfset EntitySave(blogPost) />
</cfif>
<cfimport taglib="customTags/" prefix="layout" />
<layout:page section="blog">
<!-- Content Start -->
<!--Card -->
<div id="content">
<div class="card-pattern">
<!-- blog -->
<div id="blog">
<div class="clr">
<div class="top-bg1">
<div class="top-left">
<div><h1>Blog</h1></div>
</div>
</div>
<div class="clr">
<div class="pat-bottomleft"> </div>
<div class="pat-bottomright"> </div> …Run Code Online (Sandbox Code Playgroud) 有一个搜索查询,以及我用来生成查询元素的函数
<cffunction name="GetSearchQuery" output="true" returntype="string" access="public">
<cfargument name="arrayName" type="array" required="yes">
<cfargument name="columnName" type="string" required="yes">
<cfargument name="searchtype" type="string" required="no" default="wildcard">
<cfset var o = "">
<cfset var i = "">
<cfset var search_item = "">
<cfset search_item = "(">
<cfloop from="1" to="#ArrayLen(Arguments.arrayName)#" index="o">
<cfif Arguments.arrayName[o][1] EQ #Arguments.columnName#>
<cfloop from="2" to="#ArrayLen(Arguments.arrayName[o])#" index="i">
<cfset search_item = search_item & #Arguments.columnName#>
<cfswitch expression="#Arguments.searchtype#">
<cfcase value="wildcard">
<cfset search_item = search_item & ' LIKE
<cfqueryparam value="%' & #Arguments.arrayName[o][i]# & '%"> AND '>
</cfcase>
<cfcase value="startswith">
<cfset search_item …Run Code Online (Sandbox Code Playgroud) 我想仅使用CFScript为ColdFusion组件提供可选参数,同时保持使用ColdFusion QueryParam SQL.
示例A:从所有用户的基本user.cfm中检索信息:
<cfset get = application.controller.getuser()>
Run Code Online (Sandbox Code Playgroud)
实施例B:任选地,使用相同的方法.从特定用户的基本user-edit.cfm?edit = 662B2709-0BA3-42DB-AD2CC29069F4A259中检索信息:
<cfset get = application.controller.getuser( userUID=url.edit )>
Run Code Online (Sandbox Code Playgroud)
示例C:或者,使用相同的方法查找特定的名字:
<cfset get = application.controller.getuser( firstname=form.firstname )>
Run Code Online (Sandbox Code Playgroud)
CFC问题:下面是我的controller.cfc.我想将"AND userUID =:userUID"维护为可选的CFQueryParam,仅在我的脚本请求时才会出现.
public function getuser( userUID='', password='', firstname='' ){
var get = new query();
// query
get.setSQL("
SELECT *
FROM users
WHERE 1 = 1
AND userUID = :userUID
AND firstname = :firstname
AND passhash = :password
");
if ( len(arguments.userUID) > 0 )
get.addParam( …Run Code Online (Sandbox Code Playgroud) 我有一个相当简单的CFC,带有一组属性,然后是一些与这些属性相关的基本功能.除了作为阵列的属性外,一切似乎都能正常工作......
property name="tags" type="array";
Run Code Online (Sandbox Code Playgroud)
这是该物业的简单声明.但是,当我尝试在其中一个成员函数中对它执行操作时,我收到错误...
public void function addTag(thisTag) {
var local.tags = this.getTags();
if (thisTag.isObjectValid()) {
*ArrayAppend(local.tags,arguments.thisTag);*
this.setTags(local.tags);
}
}
Run Code Online (Sandbox Code Playgroud)
与星星的线是我得到错误的地方(星星不在代码中)
Element TAGS is undefined in LOCAL.
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
附加信息:
我读到Adobe将很快停止支持Flash,并且大多数现有的Flash应用程序将被关闭.但是,CFML不仅仅是基于Flash的.那么,在Adobe取消Flash后它仍会运行吗?
我们可以在<cfset>标签内使用<cfquery>标签吗?以及如何将listqualify结果传递给<cfqueryparam>?以下是我的代码:
SELECT * FROM EMPLOYEE WHERE _id in (#listqualify(idList,"'")#
Run Code Online (Sandbox Code Playgroud)
这里idList由另一个数据源提供.我想在上面的代码上使用,以确保正确提供输入.我试过下面的代码,但不确定我是否正确的方式.
SELECT * FROM EMPLOYEE
WHERE _id in (<cfset idList=#listqualify(idList,"'")#><cfqueryparam value="#idList">)
Run Code Online (Sandbox Code Playgroud)
请帮我.
我正在启动这样的 CFC。
<cfscript>
lock scope="application" timeout="5" {
application.mycfc = new mycfc();
}
writeOutput(application.mycfc.readVars());
</cfscript>
Run Code Online (Sandbox Code Playgroud)
在 CFC 中,我正在设置一些属性。
component output="false" accessors="true" {
property name="title";
property name="foo";
this.title = "mycfc";
function init() {
this.foo = "bar";
// I can now properly read this.title, or this.foo.
return this;
}
function readVars() {
// Here, I can read this.title, from the constructor space, but I can't
// read this.foo. It's just blank (because the default value of the
// `default` attribute of `property` is …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过重新创建成功的Firebase控制台帖子的输出来通过CFHTTP正确编码对Firebase Cloud Messaging REST API的调用。以下是控制台指出的正确代码
POST /fcm/send HTTP/1.1
Host: fcm.googleapis.com
Content-Type: application/json
Authorization: key=AIzcXE
cache-control: no-cache
{
"to": "e5kpn8h9bR95NuXVHTOi50bCURG0BS4S6ccUm3X5q",
"priority": "high",
"notification" : {
"title": "",
"body" : "This is the actual message content",
"sound": "default",
"image": "https://gladevalleyanimalhospital.net/wp-content/uploads/2017/03/raster-7.png"
}
}
Run Code Online (Sandbox Code Playgroud)
这是我们当前的CFHTTP代码:
<cfhttp method="Post" url="https://fcm.googleapis.com/fcm/send">
<cfhttpparam type="header" name="Authorization" value="key=AIzXE">
<cfhttpparam type="header" name="Content-Type" value="application/json">
<cfhttpparam type="header" name="Postman-Token" value="e19b8abf3f9">
<cfhttpparam type="header" name="cache-control" value="no-cache">
<cfhttpparam type="Formfield" value="3569D24982E3B" name="to">
<cfhttpparam type="Formfield" value="high" name="priority">
<cfhttpparam type="Formfield" value="Test" name="title">
<cfhttpparam type="Formfield" value="This is the actual message content" …Run Code Online (Sandbox Code Playgroud)