如何将 c# 函数中的字符串添加到元标记(引号内)?
How do I add a string from c# function into a meta tag (inside quotes)?
这个有效
<title><%=MyLib.data.GetMetaTitle()%></title>
这不
<meta name="description" content="<%=MyLib.data.GetMetaDescription()%>" >
Returns:
<meta name="description" content="<%=MyLib.data.GetMetaDescription()%>" >
这类作品
<meta name="description" content="\"<%=MyLib.data.GetMetaDescription()%>"\" >
Returns:
<meta name="description" content="\"Meta Description"\" >
SO - 我可以让 c# 函数在引号外 运行,但我无法让数据出现在 header 的引号内。
我理解你为什么会这样,因为它需要格式化的字符串类型值,这是解决方案。
<meta name="description" content="<%=string.Format("{0}",MyLib.data.GetMetaTitle())%>"/>
希望对您有所帮助!如有任何问题,请告诉我。
快乐编码
这个有效
<title><%=MyLib.data.GetMetaTitle()%></title>
这不
<meta name="description" content="<%=MyLib.data.GetMetaDescription()%>" >
Returns:
<meta name="description" content="<%=MyLib.data.GetMetaDescription()%>" >
这类作品
<meta name="description" content="\"<%=MyLib.data.GetMetaDescription()%>"\" >
Returns:
<meta name="description" content="\"Meta Description"\" >
SO - 我可以让 c# 函数在引号外 运行,但我无法让数据出现在 header 的引号内。
我理解你为什么会这样,因为它需要格式化的字符串类型值,这是解决方案。
<meta name="description" content="<%=string.Format("{0}",MyLib.data.GetMetaTitle())%>"/>
希望对您有所帮助!如有任何问题,请告诉我。
快乐编码