我一直在经历Ruby和Ruby on Rails的速成课程,我无法弄清楚:在嵌入式ruby html文件中,有几个标签.执行<%=%>的输出<%%>,但这些标签的功能是什么:<%= - %>,最后带有" - "符号的是什么?
谢谢.
此链接包含 erb 标记的详细概述。
从网站:
识别标签
ERB 识别提供的模板中的某些标签并
根据以下规则对其进行转换:Run Code Online (Sandbox Code Playgroud)<% Ruby code -- inline with output %> <%= Ruby expression -- replace with result %> <%# comment -- ignored -- useful in testing %> % a line of Ruby code -- treated as <% line %> (optional -- see ERB.new) %% replaced with % if first thing on a line and % processing is used <%% or %%> -- replace with <% or %> respectively所有其他文本均不变地通过 ERB 过滤。