2
我baseUrl = "http://localhost:10232";
串联C#剃刀字符串与HTML字符串
我用它在我看来这样的:
<a href='@mynamespace.Controllers.MyVars.baseUrl/Tickets/Create'>Create New</a>
它给我的罚款输出即
<a href='http://localhost:10232/Tickets/Create'>Create New</a>
但是如果我想要baseurl
就像http://localhost:10232/
(现在我在最后加了一个斜线)
然后有没有办法产生像上面一样的结果?我尝试了以下方式
<a href='@mynamespace.Controllers.MyVars.baseUrl+Tickets/Create'>Create New</a>
但串联在html中不能正常工作,所以,我怎么能实现它(用HTML字符串连接AC#变量)
你尝试添加括号,如“@(mynamespace.Controllers.MyVars .baseUrl)门票/创建“? – elolos
看一下http://stackoverflow.com/questions/372865/path-combine-for-urls – dove
@elolos。正确答案。谢谢 – Sami