这是设计,但它基本上是我正在做的.我有一个像这样的@helper:
@helper MyImage(int i) {
String s = "<img src='{0}' />";
String theImage = "";
switch(i) {
case 0: theImage = "test1.png"; break;
case 1: theImage = "test2.png"; break;
default: theImage = "error.png"; break;
}
String r = String.Format(s, theImage);
@(r)
}
Run Code Online (Sandbox Code Playgroud)
我在网页上得到的输出当然是实际的字符串:
<img src='test1.png' />
Run Code Online (Sandbox Code Playgroud)
而不是图像.有没有办法禁止它以这种方式编码?
| 归档时间: |
|
| 查看次数: |
4928 次 |
| 最近记录: |