有什么区别和LT的差异;%%GT;和<%=%GT ;? [英] What is the difference between <% %> and <%=%>?

查看:179
本文介绍了有什么区别和LT的差异;%%GT;和<%=%GT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之间有什么区别<%%> <%=%> 在ASP .NET MVC?而当使用哪?

What is the difference between <% %> and <%= %> in ASP.NET MVC? And when to use which?

推荐答案

又见这个问题。 MVC并没有改变这些蜂蜇伤是如何工作的,他们只使用了多久。

See also this question. MVC hasn't changed how these bee-stings work, just how often they're used.

基本上是:


  • &LT;% - 执行code

  • &LT;%@ - page指令

  • &LT;%$ - 资源访问

  • &LT;%= - 明确的输出页

  • &LT;%# - 数据绑定

  • &LT;% - - 服务器端注释块

  • <% - execute code
  • <%@ - page directive
  • <%$ - resource access
  • <%= - explicit output to page
  • <%# - data binding
  • <%-- - server side comment block

在ASP.Net 4还有新功能:

Also new in ASP.Net 4:


  • &LT;%: - 写出的网页,但与HTML EN codeD

  • <%: - writes out to the page, but with HTML encoded

这篇关于有什么区别和LT的差异;%%GT;和&lt;%=%GT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆