没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
首先在项目里有个text.html页面 里面有showarticle,biaoti,content,author 等这些内容~!
//生成html页
public static bool writefile(string strtext string strcontent string strauthor)
{
encoding code = encoding.getencoding(" gb2312" )
// 读取模板文件
string temp = httpcontext.current.server.mappath(" text.html" )
streamreader sr = null
streamwriter sw = null
string str = " "
try
{
sr = new streamreader(temp code)
str = sr.readtoend() // 读取文件
}
catch (exception exp)
{
httpcontext.current.response.write(exp.message)
httpcontext.current.response.end()
sr.close()
}
string htmlfilename = datetime.now.tostring(" yyyymmddhhmmss" ) + " .html"
// 替换内容
// 这时 模板文件已经读入到名称为str的变量中了
str = str.replace(" showarticle" strtext) //模板页中的showarticle
str = str.replace(" biaoti" strtext)
str = str.replace(" content" strcontent)
str = str.replace(" author" strauthor)
// 写文件
//生成html页
public static bool writefile(string strtext string strcontent string strauthor)
{
encoding code = encoding.getencoding(" gb2312" )
// 读取模板文件
string temp = httpcontext.current.server.mappath(" text.html" )
streamreader sr = null
streamwriter sw = null
string str = " "
try
{
sr = new streamreader(temp code)
str = sr.readtoend() // 读取文件
}
catch (exception exp)
{
httpcontext.current.response.write(exp.message)
httpcontext.current.response.end()
sr.close()
}
string htmlfilename = datetime.now.tostring(" yyyymmddhhmmss" ) + " .html"
// 替换内容
// 这时 模板文件已经读入到名称为str的变量中了
str = str.replace(" showarticle" strtext) //模板页中的showarticle
str = str.replace(" biaoti" strtext)
str = str.replace(" content" strcontent)
str = str.replace(" author" strauthor)
// 写文件
资源评论
普通网友
- 粉丝: 1
- 资源: 101
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功