惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Cloudbric
Cloudbric
T
The Blog of Author Tim Ferriss
美团技术团队
S
SegmentFault 最新的问题
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
IT之家
IT之家
P
Privacy & Cybersecurity Law Blog
N
News and Events Feed by Topic
爱范儿
爱范儿
T
Threatpost
The Cloudflare Blog
Spread Privacy
Spread Privacy
Latest news
Latest news
Last Week in AI
Last Week in AI
V
Vulnerabilities – Threatpost
Hugging Face - Blog
Hugging Face - Blog
T
Tor Project blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Project Zero
Project Zero
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
Tenable Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 司徒正美
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
The Exploit Database - CXSecurity.com
Security Latest
Security Latest
C
CERT Recently Published Vulnerability Notes
T
Threat Research - Cisco Blogs
Hacker News - Newest:
Hacker News - Newest: "LLM"
有赞技术团队
有赞技术团队
P
Proofpoint News Feed
Hacker News: Ask HN
Hacker News: Ask HN
L
Lohrmann on Cybersecurity
阮一峰的网络日志
阮一峰的网络日志
C
Cyber Attacks, Cyber Crime and Cyber Security
量子位
I
Intezer
C
Check Point Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 【当耐特】
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
N
Netflix TechBlog - Medium
H
Heimdal Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Blog — PlanetScale
Blog — PlanetScale
G
Google Developers Blog

szhshp 的第三边境研究所

假设, AI 把我代替的那一刻真的到来 | szhshp 的第三边境研究所 小傻瓜都能懂的 AstrBot QQ 机器人集成 MCP 功能实战指南 | szhshp 的第三边境研究所 《智人之上: 从石器时代到 AI 时代的信息网络简史》阅读笔记 | szhshp 的第三边境研究所 iPadOS 26 无法设置空间场景图片壁纸的解决方法 | szhshp 的第三边境研究所 《一路云海》(终) | szhshp 的第三边境研究所 《一路云海》(四): 如何不按套路旅行 | szhshp 的第三边境研究所 《一路云海》(三): In Ya Mellow Tone | szhshp 的第三边境研究所 《一路云海》(二): 关西世博参观纪实 | szhshp 的第三边境研究所 《一路云海》(一): 新的征程 | szhshp 的第三边境研究所 2025 大阪世博会 [ 3 天前-先到先得 ] 阶段 场馆预约必中独家攻略 | szhshp 的第三边境研究所 Hackathon 随想 | szhshp 的第三边境研究所 一杯双皮奶 | szhshp 的第三边境研究所 Armbian + CasaOS + NAS 配置指南 | szhshp 的第三边境研究所 Docker 构建镜像报错: error getting credentials - err: exit status 1, out: `` | szhshp 的第三边境研究所 Disqus RIP! 论过高的维护成本如何治疗固执的坏习惯 | szhshp 的第三边境研究所 炸弹猫桌游变体规则 | szhshp 的第三边境研究所 《小岛经济学》阅读笔记 | szhshp 的第三边境研究所 《金钱心理学》阅读笔记 | szhshp 的第三边境研究所 为知笔记 RIP: 迁移剩余的笔记 | szhshp 的第三边境研究所 2025 博客第十年展望 - 再见我的过去 | szhshp 的第三边境研究所 我在独立游戏里面致敬的作品 | szhshp 的第三边境研究所 《How to make thing faster》阅读笔记 | szhshp 的第三边境研究所 《The Art of Clean Code》阅读笔记 | szhshp 的第三边境研究所 《Clean Architecture: A Craftsman Guide to Software Structure and Design》阅读笔记 | szhshp 的第三边境研究所 《How AI Works》阅读笔记 | szhshp 的第三边境研究所 游戏策划废案 - Project Uranus | szhshp 的第三边境研究所 游戏策划废案 - Project X | szhshp 的第三边境研究所 人生第一款独立游戏开发复盘 | szhshp 的第三边境研究所 Trap of Life | szhshp 的第三边境研究所 如果我用手搓了个暗物质雏形 | szhshp 的第三边境研究所 《Rust Programming Language》- EX - Cheatsheet | szhshp 的第三边境研究所 新的播放器上线了 | szhshp 的第三边境研究所 Cypress - End-to-End Testing: OKTA Authentication with MFA | szhshp 的第三边境研究所 VSC x VIM - 反正多学几个快捷键没有坏处 | szhshp 的第三边境研究所 两小时 Docker 速成 - Getting Started | szhshp 的第三边境研究所 《The Joy of Javascript》- 5 - Data | szhshp 的第三边境研究所 《The Joy of Javascript》- 4 - Meta Programming | szhshp 的第三边境研究所 《The Joy of Javascript》- 3 - ADT(Algebraic Data Type) | szhshp 的第三边境研究所 Web-Automation Testing | szhshp 的第三边境研究所 《The Joy of Javascript》- 2 - Functor/Monad | szhshp 的第三边境研究所 《The Joy of Javascript》- 1 - Object/Function | szhshp 的第三边境研究所 EvalError: Possible side-effect in debug-evaluate | szhshp 的第三边境研究所 前端 QA 工具链指南 - husky,commitlint,commitizen,eslint,typescript,express | szhshp 的第三边境研究所 效率工具 & 软件推荐 | szhshp 的第三边境研究所 站点开源 Project Titan | szhshp 的第三边境研究所 cmd/powershell-命令速查-Cheatsheet | szhshp 的第三边境研究所 Git-命令速查与相关问题解决-Cheatsheet & Troubleshooting | szhshp 的第三边境研究所 Tailwind.css not included in NextJS Production | szhshp 的第三边境研究所 Github GraphQL API - Data Integration | szhshp 的第三边境研究所 尝试 Windows Terminal + z.lua | szhshp 的第三边境研究所 StrokePlus.net - Powerful Hotkey Boost | szhshp 的第三边境研究所 优雅地 Hack 一台黑苹果 | szhshp 的第三边境研究所 一杯关东煮 | szhshp 的第三边境研究所 Gitee x PicGo 管理图床 | szhshp 的第三边境研究所 Create Your Own Redux (Typescript) | szhshp 的第三边境研究所 Getting Started: Ionic + Capacitor + React + Typescript + Android | szhshp 的第三边境研究所 GraphQL: File Upload & Troubleshooting | szhshp 的第三边境研究所 吉祥航空随心飞刷票工具循环查票工具 | szhshp 的第三边境研究所 NVM Windows Portable Installation | szhshp 的第三边境研究所 NextJS x Typescript - Integration & Troubleshooting | szhshp 的第三边境研究所 全站点升级 - Project Titan | szhshp 的第三边境研究所 AWS-EC2-常见问题解决-Troubleshooting | szhshp 的第三边境研究所 Workbox-Getting Started | szhshp 的第三边境研究所 《时间简史》阅读笔记 | szhshp 的第三边境研究所 《时间的秩序》阅读笔记 | szhshp 的第三边境研究所 ESLint-常见问题解决-Troubleshooting | szhshp 的第三边境研究所 站点索引 | szhshp 的第三边境研究所 个人知识库搭建 - Hexo 实现 Github/Coding 持续集成 | szhshp 的第三边境研究所 BMOB-常见问题解决-Troubleshooting | szhshp 的第三边境研究所 React + Typescript: 开启 HMR/Hot Loader | szhshp 的第三边境研究所 Yarn & NPM | szhshp 的第三边境研究所 ESLint: Typescript + React + TSX 集成 | szhshp 的第三边境研究所 《10101》EP15:过年 2020 | szhshp 的第三边境研究所 Cmder-Usage | szhshp 的第三边境研究所 Redux-DOM not refreshed | szhshp 的第三边境研究所 React Semantic UI-CheatSheet | szhshp 的第三边境研究所 Typescript: Getting Started | szhshp 的第三边境研究所 Flutter-Getting Started | szhshp 的第三边境研究所 Typescript: Access window object with type check | szhshp 的第三边境研究所 VSC Extension Development-Create A Code Formatter Extension | szhshp 的第三边境研究所 OneNote Extension-Main API | szhshp 的第三边境研究所 TortoiseGit Win10 Icon not showing correctly | szhshp 的第三边境研究所 Mongoose: aggregate() 方法实现聚合函数 | szhshp 的第三边境研究所 React In Depth - React 源码解析 - render() & Fiber | szhshp 的第三边境研究所 MongoDB x Mongoose: 实现类似 Join 的功能 | szhshp 的第三边境研究所 Disqus 评论框改造工程-实现 Disqus 代理的 Serverless 服务 | szhshp 的第三边境研究所 GUI, CLI, Terminal, Shell, TTY, Console, Bash | szhshp 的第三边境研究所 Jest Async Best Practise: No Nested Async | szhshp 的第三边境研究所 关系型数据库与非关系型数据库优缺点分析 | szhshp 的第三边境研究所 New Edge & Chromium Error - Package is invalid: 'CRX_VERSION_NUMBER_INVALID' | szhshp 的第三边境研究所 选择 GraphQL 的 N 个理由 | szhshp 的第三边境研究所 StrokePlus - 鼠标手势神器的代码编写技巧 | szhshp 的第三边境研究所 嗨,好久不见 | szhshp 的第三边境研究所 Vue + ElementUI 集成 Vue Router | szhshp 的第三边境研究所 IE8 - Unknown Runtime Error Using innerHTML & Ajax | szhshp 的第三边境研究所 React: Handling Events | szhshp 的第三边境研究所 React-Navigation Integration with Redux | szhshp 的第三边境研究所 React: States is tricky | szhshp 的第三边境研究所 《10101》EP14:小剧场 | szhshp 的第三边境研究所 ColdFusion - Basic - arguments in cffunction | szhshp 的第三边境研究所
ColdFusion - Getting Started | szhshp 的第三边境研究所
2019-01-01 · via szhshp 的第三边境研究所

Meta

目录

关于变量名称

  1. 不能用数字开始
  2. 不能包含空格
  3. 不能使用除去下滑线以外的特殊符号
  4. 大小写不敏感

特殊: 关于井号#的使用

标记函数和变量的时候需要用到井号 输入两个连续的井号(##)就表示一个单个井号(#)

Loop

Basic Loop

Syntax

<cfloop index="parameter name" from="beginning value" to="ending value" step="increment" charset "charset to read in a file">
  HTML or CFML code ……
</cfloop>

Examples

<cfloop from="1" to="10" step="2" index="i">
  <cfoutput>
    <li>#i#</li>
  </cfoutput>
</cfloop>

break

<cfbreak>

Loop for List

<cfset test="aaa,bbb,ccc,ddd">

  <cfloop list="#test#" index="i">
    <cfoutput>
      #i#
    </cfoutput>
  </cfloop>

在 loop 中使用其他列表的时候需要加上对应的井号 #test# 希望输出列表内容的时候直接使用 index 参数就可以了

另一种可以获取到 index 的循环模式:

<cfset list="Partner,Response Date,Response Status" />
<cfloop from="1" to="#listLen(list)#" index="i">
  <cfoutput>
    listGetAt(list, i)
  </cfoutput>
</cfloop>

Query 循环

Syntax

<cfloop  
    query = "query name" 
    startRow = "row number" 
    endRow = "row number"> 
</cfloop>

Example

从 cc_TEST 表中搜索前十个数据, 放到 TEST 的 <cfQuery> 之中

几个需要注意的地方:

  • 循环里面直接使用对应的列名就可以
  • <cfloop query="TEST"> 的 query 属性中不需要添加井号
  • <cfloop> 内部语句需要使用 <cfoutput> 进行转换, <cfoutput> 可以放在外层以减少使用次数
<cfquery name="query" datasource="cc_query" result="result">
  SELECT TOP(10) * FROM SITE
</cfquery>
<cfdump var="#query#" />

<cfloop query="query">
  <cfoutput>
    #query.CurrentRow# #ADMIN#
  </cfoutput>
</cfloop>

<cfoutput>
  #result.sql#
</cfoutput>

此外还可以直接使用 <cfoutput> 的 Query 属性来输出 同样直接使用对应的列名

<cfoutput query="query">
  #ADMIN#
</cfoutput>

Structure 循环

Syntax

<cfset myBooks=StructNew()>
<cfset myVariable=StructInsert(myBooks,"ColdFusion","ColdFusion MX Bible")>
<cfset myVariable=StructInsert(myBooks,"HTML","HTML Visual QuickStart")>
<cfset myVariable=StructInsert(myBooks,"XML","Inside XML")>
<cfloop collection="#myBooks#" item="subject">
<cfoutput>
<b>#subject#:</b> #StructFind(myBooks,subject)#<br />
</cfoutput>
</cfloop>

显示结果:

HTML: HTML Visual QuickStart
ColdFusion: ColdFusion MX Bible
XML: Inside XML

Attributes

  • query

Required Query that controls the loop.

  • startRow
  • endRow

API

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7fae.html

数组与转储

示例

<cfset names=ArrayNew(2)>

<cfset names[1][1]="test">
<cfset names[1][2]="test123">
<cfset names[2][1]="test4343">
<cfset names[2][2]="test1235454">
<cfset names[3][1]="43">
<cfset names[3][2]="123">

用法

  • ArrayNew()

表示建立一位数组

  • ArrayNew(X)

表示建立 X 维数组, 随后赋值的数据必须有 X 个 index

<cfset names=ArrayNew(3)>
<cfset names[1][1][1]="test">
<cfset names[1][2][2]="test123">
<cfset names[3][2][5]="43">
<cfset names[4][2][4]="42">
  • 使用 <cfdump> 标签可以查看对应的变量的数据
<cfdump var="#names#">

流程控制

条件判断 cfif

<cfif (#i#+#j# IS 10)>
  do sth……
  <cfelse>
    do sth else……
</cfif>

cfswitch

<cfswitch expression="#Trim(Department)#">
  <cfcase value="Sales">
    #FirstName# #LastName# is in <b>sales</b>
  </cfcase>
  <cfcase value="Accounting">
    #FirstName# #LastName# is in <b>accounting</b>
  </cfcase>
  <cfcase value="Administration">
    #FirstName# #LastName# is in <b>administration</b>
  </cfcase>
  <cfdefaultcase>
    #FirstName# #LastName# is not in Sales, Accounting, or
    Administration.
  </cfdefaultcase>
</cfswitch>
switch(fruit) {
    case "apple":
         WriteOutput("I like Apples");
         break;
    case "orange":
         WriteOutput("I like Oranges");
         break;
    default: 
         WriteOutput("I like fruit");
}

CFML 计算操作符

  • IS/EQ: equal to
  • IS NOT/NEQ: not equal to
  • GT: greater than, bigger than
  • GTE: greater then or equal to
  • LT: less than
  • LTE: less than or equal to

CFML 逻辑运算符

  • AND
  • PR
  • XOR: 异或, 其一为 true 而不能同时为 true
  • EQV: 等价, 两个条件相同时返回 true
  • IMP: 蕴含, 第一个条件为 true, 第二个条件为 false 返回 false
  • NOT

字符串

[待补充]特殊符号的使用

例如使用单引号

<cfset URL.customGroupSitesExtraSQL = customGroupSitesExtraSQL & "'#SiteID#'"/>

运算符

求余数

MOD or %

注意余数运算的时候小数部分会被忽略:

11.7 MOD 4 = 3