简单开关操作关注取消关注

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_42693512/article/details/81180936
var onOff = true;
$("#followbtn").click(function () {
    if (onOff){
        getSenderfollow();
        console.log("已关注");
        onOff = false;
    }else{
        ungetSenderfollow();
        console.log("取消关注");
        onOff = true;
    }
})
展开阅读全文

关注!!!关注!!!

12-26

大家看看怎么样才能正确将WebResponse取得的文件编码rnrnrnusing System;rnusing System.Collections;rnusing System.ComponentModel;rnusing System.Data;rnusing System.Drawing;rnusing System.Web;rnusing System.Web.SessionState;rnusing System.Web.UI;rnusing System.Web.UI.WebControls;rnusing System.Web.UI.HtmlControls;rnusing System.IO;rnusing System.Net;rnusing System.Text;rnrnnamespace getfilernrn public class WebForm1 : System.Web.UI.Pagern rn protected override void OnLoad(EventArgs e)rn rn Response.Clear();rnrn string url = Request.QueryString["url"];rn if (null == url || url.Trim().Length == 0)rn rn Response.End();rn return;rn rnrn tryrn rn WebRequest request = WebRequest.Create(url);rn request.Method = Request.RequestType;rn request.ContentType = Request.ContentType;rnrn int reads = 0;rn byte[] buffer = new byte[512];rn rn if (Request.RequestType.Equals("POST"))rn rn if (null != Request.Form) rn rn using (Stream s = request.GetRequestStream())rn rn while ((reads = Request.InputStream.Read(buffer, 0, buffer.Length)) > 0)rn rn s.Write(buffer, 0, reads);rn rn s.Flush();rn rn rn rnrn WebResponse response = request.GetResponse();rn Response.ContentType = response.ContentType;rn using (Stream s = response.GetResponseStream())rn rn while ((reads = s.Read(buffer, 0, buffer.Length)) > 0)rn rn //Response.OutputStream.Write(buffer, 0, reads);rn writeFile(buffer,Server.MapPath(".") + @"\my.xls");rn rn rn response.Close();rn rn catch(Exception ex)rn rn ex.ToString();rn rnrn Response.End();rn base.OnLoad (e);rn rnrnrn /// rn /// 写文件rn /// rn /// 需要写入的byte字节流rn /// 要写入的文件的名称及其绝对路径rn /// 返回bool值是否成功rn public bool writeFile(byte[] mybt,string filename)rn rn tryrn rn StreamWriter write = new StreamWriter(filename,true);rn System.Text.Encoding myen = Encoding.GetEncoding("GB2312");rn //byte[] wbyt = Encoding.Convert(Encoding.Default,Encoding.GetEncoding("GB2312"),mybt,0,mybt.Length);rn string mystr = myen.GetString(mybt,0,wbyt.Length);rnrn write.Write(mystr);rn write.Close();rn return true;rn rn catch(Exception ex)rn rn ex.ToString();rn return false;rn rn rnrn private void Page_Load(object sender, System.EventArgs e)rn rn rnrnrn #region Web 窗体设计器生成的代码rn override protected void OnInit(EventArgs e)rn rn InitializeComponent();rn base.OnInit(e);rn rn rn private void InitializeComponent()rn rn this.Load += new System.EventHandler(this.Page_Load);rn rn #endregionrn rnrn 论坛

没有更多推荐了,返回首页