c:foreach怎么把获取当前行的信息呢?

我在c:foreach每一行前面加了个勾选框,现在想获取勾选的那一行的值,请问怎么实现呢?

2个回答

每一行取一个id,js通过id获取元素,然后find你需要的值

lvyanqin2013
zilin-lynn $(this).find("a").attr("data-p1"),这样再取出来
3 年多之前 回复
lvyanqin2013
zilin-lynn <td class="history"><a data-p1="${a.p1}" data-p2="${a.p2}" ></td>
3 年多之前 回复
lvyanqin2013
zilin-lynn 回复hc105331: 你是想获取数据?
3 年多之前 回复
hc105331
hc105331 我想获取的是那一行从后台传来的完整信息
3 年多之前 回复

循环的list的值能获取到,我是想获取当前被勾选的那一行的值

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
jQuery ajax 获取 c:foreach 遍历的cheakbox复选框选中的值
<form action="updatejystate.action"> <c:forEach items="${sessionScope.jiaoyilist}" var="li" varStatus="status"> <div class="hh1"> <div class="hh"> <div class="box"> <div id="1" class="leftbox"> <input type="checkbox" name="jidlist" value="${li.id}"/> </div> <div class="mbox"> <img src="img/n26.png"> </div> <div class="rbox"> <div class="t1"> <p class="zi3"> <a><div><c:out value="${li.guige}"></c:out></div></a> <a><div class="pric"><c:out value="${li.price}"></c:out>&nbsp;&nbsp;</div></a> <a><div class="q1"> <div class="p"> <a class="sum1">数量:<c:out value="${li.sum}"></c:out></a> <a>金额:<p value="${li.sum}"></p> </a> </div> </div></a> <a href="deleteJiaoyiById.action?jiaoyi.id=${li.id}">删除</a> </div> </p> </div> </div> <div class="henggang"></div> <div class="foot"> </div> </div> </div> </c:forEach> 怎样通过jquery获取复选框选中的当前记录的值
我用这种方式获取后台的list集合,但是怎么获取当前点击的对象的id
function gotos(){ <c:forEach items="${daodulist}" var="v" varStatus="status"> var id = "${v.id}"; </c:forEach> };
C# WMI 远程访问指定服务器,获取服务器上运行的服务,提示拒绝访问。
ConnectionOptions connectionOptions = new ConnectionOptions(); connectionOptions.Username = serverInstance.LoginUserName; connectionOptions.Password = serverInstance.LoginPassword; connectionOptions.Authority = "ntlmdomain:DOMAIN"; ManagementScope managementScope = new ManagementScope("\\\\" + serverInstance.ServerName + "\\root\\cimv2", connectionOptions); managementScope.Connect(); //查询当前的服务信息 ObjectQuery oq = new ObjectQuery("SELECT * FROM Win32_Service "); //执行查询 ManagementObjectSearcher searcher = new ManagementObjectSearcher(managementScope, oq); foreach (ManagementObject queryObj in searcher.Get()) { //此处省略获取服务的相关操作,因为出问题的地方就在foreach这句上 ...... } 在foreach时提示拒绝访问,不知道是否为权限不够所造成的此情况发生。 在实际项目中,在调用这个获取远程服务器上服务信息之前,还有一段代码是获取远程服务器上的进程信息,获取进程的代码已经成功执行完毕; 此问题出现的情况如下: 当我使用administrator的账户、密码进行远程获取进程或服务信息时完全没有问题;但是一旦切换为我指定的一个账户、密码进行操作时,获取进程没有问题,但获取服务时却出现了如题的状况;前提是我这个指定的账户已经将其分配到“管理员”组中,相应WMI操作权限也已经给予这个指定账户。 我在使用wbemtest链接时,也用指定的账户进行登录,执行查询进程信息或服务信息时,均报出错误信息: 编号: 0x80070005 设备: Win32 描述: 拒绝访问 下面我列出我这个指定账户的信息: 用户名:Monitor 密码://省略就不在此说明了 用户隶属于组:User组,Administrators组 求高手指点,如果的确为权限上的问题,请尽量逐步说明设置权限的步骤
JQuery如何获取循环输出的文本框值
我是初学者,现在做一个用JQuery实现的购物车,SSH框架,JSP页部分代码如下: [code="java"] <c:set scope="session" value="${sessionScope.cart}" var="cart"></c:set> <c:forEach items="${cart.items}" var="ci"> <tr> <td><input type="image" height="80" alt="${ci.commodity.commName }" src="${ci.commodity.simallPic }"/></td> <td>${ci.commodity.commName }<input type="hidden" class="commodityid" value="${ci.commodity.id }" /></td> <td>${ci.commodity.sizeChart }</td> <td>${ci.commodity.sellingPrice }</td> [color=red] <td ><input type="text" value="${ci.count}" class="count" ></td>[/color]//点这个就获取当前的文本框值 <td>${ci.sumprice }</td> </tr> </c:forEach>[/code] JS部分代码: [code="java"]$(".count").blur( function() { $.ajax({ type:"post", url:"saveCart.do?operate=addToCart?", data:{'count=':$(".count").val(),'&commodityid=':$(".commodityid").val()}, timeout: 2000, success:function(data){ alert('ok'); } , error: function(){ alert('错误'); alert($(".count").val()); alert($(".commodityid").val()); } }); }); [/code] 现在想点某一个文本框后获取对应的文本框值,但是总是只能获取第一次循环出来的,求教各位帮小弟解决下,不胜感激。 或者谁能发下修改商品数量后自动更改价格的代码也行,谢谢了。
MVC在IIS服务器获取用户IP地址
有个需求:用户异常预警。如果用户当前登录不是上一次的电脑登录就提示用户。账号异常,并告知用户上一次登录IP地址是多少。 问题:服务器有负债均衡。 string HostName = string.Empty; string ip = string.Empty; string ipv4 = String.Empty; if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"])) ip = Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]); if (string.IsNullOrEmpty(ip)) ip = System.Web.HttpContext.Current.Request.UserHostAddress; //// 利用 Dns.GetHostEntry 方法,由获取的 IPv6 位址反查 DNS 纪录,<br> // 再逐一判断何者为 IPv4 协议,即可转为 IPv4 位址。 foreach (System.Net.IPAddress ipAddr in System.Net.Dns.GetHostEntry(ip).AddressList) { if (ipAddr.AddressFamily.ToString() == "InterNetwork") { ipv4 = ipAddr.ToString(); } } return ipv4; ``` 以上代码只能获取 负债均衡的服务器IP地址。请问有什么好的办法解决获取用户的IP. ``` ```
关于C#下基于snmpsharpnet的snmp开发中IPV6的问题。
在网上找到了一些获取主机的磁盘使用情况的代码: protected void Button1_Click(object sender, EventArgs e) { double[] diskstorage1, diskstorage2; diskstorage1 = snmpget("127.0.0.1", "public", 1); this.Label1.Text += Environment.NewLine; diskstorage2 = snmpget("fe80::357b:bacf:e6b4:5910%3", "public", 2); //foreach (double dou in diskstorage1) //{ // this.txtContent.Text += string.Format("{0} GB \r\n", dou.ToString("f2")); //} } 如上面的diskstorage2 中,将IP地址写成IPV6的地址就会发生如下错误: Request has reached maximum retries. 说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: SnmpSharpNet.SnmpException: Request has reached maximum retries. 源错误: 行 73: 行 74: // Make SNMP request 行 75: result = (SnmpV1Packet)target.Request(pdu, param); 行 76: 行 77: // If result is null then agent didn't reply or we couldn't parse the reply. 源文件: e:\Program Files (x86)\Visual Studio 2010\WebSites\biyesheji\mange\getDISK.aspx.cs 行: 75 堆栈跟踪: [SnmpException: Request has reached maximum retries.] SnmpSharpNet.UdpTransport.Request(IPAddress peer, Int32 port, Byte[] buffer, Int32 bufferLength, Int32 timeout, Int32 retries) +1088 SnmpSharpNet.UdpTarget.Request(Pdu pdu, IAgentParameters agentParameters) +670 mange_Default.snmpget(String ipaddress, String comname, Int32 i) in e:\Program Files (x86)\Visual Studio 2010\WebSites\biyesheji\mange\getDISK.aspx.cs:75 mange_Default.Button1_Click(Object sender, EventArgs e) in e:\Program Files (x86)\Visual Studio 2010\WebSites\biyesheji\mange\getDISK.aspx.cs:22 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9628722 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724 是否是ipadress这个元数据中没有定义IPV6的相关类,还是UdpTransport中INT32需要改成INT128?如果是该怎么修改?
ssm pageheleper 模糊查询语句出错
@RequestMapping("mohu") public String mohuchaxun(@RequestParam(value="pn",defaultValue="1")Integer pn,Model model,books bk){ //从第一条开始 每页查询五条数据 PageHelper.startPage(pn, 3); List<books> users = userService.mohu(bk); System.out.println("测试集合有没有获取到数据"+bk.getBookuser()); System.out.println("大小"+users.size()); //将用户信息放入PageInfo对象里 PageInfo page1 = new PageInfo(users,7); model.addAttribute("pageInfo2", page1); return "mohu"; } -----------------------------------------------------------------controller <select id="mohu" parameterType="books" resultType="books"> select * from books where bookuser LIKE '%' #{bookuser} '%' </select> -------------------------------------------------------------------dao.xml <c:forEach items="${pageInfo2.list }" var="user"> <tr> <td>${user.bid}</td> <td>${user.bookuser }</td> <td>${user.booktype }</td> <td><img src="${user.bookimg}" width="200" height="100" ></td> <!-- <td><img src="${user.bookimg}" width="200" height="300" ></td> --> <!-- <td><a class="edit">编辑</a> <a class="delete">删除</a></td> --> </tr> </c:forEach> </table> </div> </div> <hr style="height:1px;border:none;border-top:1px solid #ccc;" /> <!-- 分页导航栏 --> <!-- 分页信息 --> <div class="row"> <!-- 分页文字信息,其中分页信息都封装在pageInfo中 --> <div class="col-md-6"> 当前第:${pageInfo2.pageNum}页,总共:${pageInfo2.pages}页,总共:${pageInfo2.total}条记录 </div> <!-- 分页条 --> <div class="col-md-6"> <nav aria-label="Page navigation"> <ul class="hvtulli" style="list-style-type:none"> <li><a href="${path}/user/mohu?pn=1">首页</a></li> <c:if test="${pageInfo2.hasPreviousPage }"> <li> <a href="${path}/user/mohu?pn=${pageInfo2.pageNum-1}" aria-label="Previous"> <span aria-hidden="true">上一页</span> </a> </li> </c:if> <c:forEach items="${pageInfo2.navigatepageNums }" var="page_Num"> <c:if test="${page_Num == pageInfo2.pageNum }"> <li class="active"><a href="#">${ page_Num}</a></li> </c:if> <c:if test="${page_Num != pageInfo2.pageNum }"> <li><a href="${path}/user/mohu?pn=${ page_Num}">${ page_Num}</a></li> </c:if> </c:forEach> <c:if test="${pageInfo2.hasNextPage }"><a href="${path}/user/mohu?pn=${pageInfo2.pageNum+1}" aria-label="Next">下一页 </a> </c:if> <a href="${path}/user/mohu?pn=${pageInfo2.pages}">末页</a> -----------------------------------------------------------jsp 普通的查询这样都可以做到。 但是这个模糊查询,点击首页或者末页就会报错, Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null '%') tmp_count' at line 2 ### The error may exist in com/ssm/dao/Userdao.xml ### The error may involve com.ssm.dao.Userdao.mohu-Inline ### The error occurred while setting parameters ### SQL: select count(0) from (select * from books where bookuser LIKE '%' ? '%') tmp_count 知道是sql的错误, 请大神帮我看看怎么办。 我是初学者。
jsp+servlet+sqlserver分页,前台获取的ID总为每一页信息的最后一项的ID?
# 求教大神:JSP+servlet+sqlserver分页查询后,在页面获取ID时,不管点击哪一项,传到后台的ID值都为每一页信息的最后一项的ID? ![这是前台页面](https://img-ask.csdn.net/upload/201704/12/1491958509_846310.png) serverlt代码: int pageIndex = 1;//页数 int pageCount = 0;//总页数 int count = 0;//总数据条数 Session session = HibernateUtil.openSession(); //数据总条数查询 SQLQuery sqlquery1 = session.createSQLQuery("select count(userID) from t_user"); List<Integer> numList = sqlquery1.list(); count = numList.get(0); pageCount = count/20+(count/20!=0?1:0);//总页数 //按钮处理分页 String indexnum = request.getParameter("pageindex"); if(indexnum!=null&&Integer.parseInt(indexnum)<=pageCount&&Integer.parseInt(indexnum)>0){ pageIndex = Integer.parseInt(indexnum); } //数据查询 SQLQuery sqlquery = session.createSQLQuery("select top 20 " + "u.userID,u.name,ad.address, ad.communityID,c.community,ad.building,ad.unit,ad.houseNum,u.phone,u.openDate,u.chageDate,u.isPrePaid,u.buyTimes "+ " from t_user as u left join t_address as ad on u.addressID=ad.addressID left join t_area as ar on ad.areaID=ar.areaID "+ " left join t_community as c on c.communityID=ad.communityID " +"where userID not in (select top "+20*(pageIndex-1)+" userID from t_user ) order by userID"); List<Object[]> olist = sqlquery.list(); //将要显示的字段传到userInfo.jsp request.setAttribute("olist", olist);//用户信息 request.setAttribute("count", count);//数据总条数 request.setAttribute("pageCount", pageCount);//数据总页数 request.setAttribute("pageIndex", pageIndex);//当前页数 request.getRequestDispatcher("userInfo.jsp").forward(request, response); ``` 前端代码: <c:forEach items="${olist }" var="o" > <tr> <td height="20" bgcolor="#FFFFFF"><div align="center"> <input type="checkbox" name="checkbox2" value="checkbox" /> </div></td> <td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE1"> <div align="center">${o[0] }</div> </div></td> <td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">${o[1] }</span></div></td> <td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">${o[2] }</span></div></td> <td bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">${o[3] }</span></div></td> <td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">${o[4] }</span></div></td> <td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">${o[5] }</span></div></td> <td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">${o[6] }</span></div></td> <td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">${o[7] }</span></div></td> <td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">${o[8] }</span></div></td> <td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">${o[9] }</span></div></td> <td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">${o[10] }</span></div></td> <td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">${o[11] }</span></div></td> <td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">${o[12] }</span></div></td> <td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE4"> <a><img src="images/edt.gif" width="13" height="13" />编辑</a>&nbsp; <a href="#" onclick="del()"><img src="images/del.gif" width="13" height="13" />删除</a> <script> function del(){ if(window.confirm("是否删除用户?")==true){ window.location.href="moduser?type=2&id="+${o[0] }; } } </script> </span></div></td> </tr> # </c:forEach> ```
C# ListView 详细信息视图空白
winform 运行程序后Listview有数据,但是切换到详细信息视图就空白了,其他视图全都正常,不知道是什么原因? 数据全都没问题的 链接:https://pan.baidu.com/s/1fR4isB2wspIO7ybBTxSwjw 提取码:lno6 项目我放在了百度, 各位大佬帮我看一下 ``` namespace BookMarksMessages { public partial class Root : Form { public Root() { InitializeComponent(); TreeNode treeNode1 = new TreeNode("根目录"); treeNode1.Text = "根目录"; Directory.Nodes.AddRange(new TreeNode[] { treeNode1}); //BookMarksList.GridLines = true;//显示行与行之间的分隔线 //BookMarksList.FullRowSelect = true;//要选择就是一行 } private void Under_Development_Click(object sender, EventArgs e) { MessageBox.Show("此功能正在开发中...\n敬请期待","开发中...",0); } private void List_Switch(object sender, EventArgs e) { string view = (sender as ToolStripMenuItem).Name.ToString(); this.BookMarksList.View = (View)Enum.Parse(typeof(View), view); } private void ExportToHTML_Click(object sender, EventArgs e) { SaveFileDialog saveFile = new SaveFileDialog(); saveFile.Filter = "所有文件(*.*)|*.*|HTML文件(*.html)|*.html"; //保存时为之前的目录 saveFile.RestoreDirectory = true; //保存文件对话框的默认保存类型,默认索引从1开始 saveFile.FilterIndex = 2; if (saveFile.ShowDialog() == DialogResult.OK) { try { FileStream file = new FileStream(saveFile.FileName,FileMode.Create,FileAccess.Write,FileShare.Write); string str = "测试文本"; //字符串转byte[] byte[] bytes = new UTF8Encoding(true).GetBytes(str); //写入字符串 file.Write(bytes, 0, bytes.Length); file.Close(); MessageBox.Show("保存成功!"); } catch (Exception ex) { MessageBox.Show("文件保存错误:\n" + ex); } } } private void ImportFromHTML_Click(object sender, EventArgs e) { OpenFileDialog openFile = new OpenFileDialog(); //设定只能打开HTML文件,文件类型不用加()不然会出错 openFile.Filter = "HTML文件(*.html)|*.html"; //打开时为之前的目录 openFile.RestoreDirectory = true; if (openFile.ShowDialog() == DialogResult.OK) { try { //打开文件,参数列表: 文件名,打开模式,打开权限,其他可以访问此文件的权限 FileStream file = File.Open(openFile.FileName, FileMode.Open, FileAccess.Read, FileShare.Read); //创建读取文件流实例,参数为: 已打开的文件流,编码方式,一般为默认(操作系统当前的编码) StreamReader sr = new StreamReader(file, Encoding.Default); //读取文件并保存到str字符串 string str = sr.ReadToEnd(); HtmlWeb htmlWeb = new HtmlWeb(); HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument(); //document.Text获取内容 document.LoadHtml(str); //分别用xpath和正则获取内容 //练习 #region 正则 //Regex reg = new Regex("HREF=\"([^\"]+)\""); //MatchCollection result = reg.Matches(document.Text); //string href = ""; //foreach (Match m in result) //{ // reg = new Regex("\".+\""); // Match a = reg.Match(m.ToString()); // href = href + a.ToString() + Environment.NewLine; //} //reg = new Regex("[^\"]+"); //result = reg.Matches(href); //string href1 = ""; //foreach (Match m in result) { // href1 = href1 + m.ToString() + Environment.NewLine; //} #endregion #region xpath HtmlNodeCollection htmlNodes = document.DocumentNode.SelectNodes("//a[@href]"); if (htmlNodes != null) { BookMarksList.Clear(); foreach (HtmlNode n in htmlNodes) { HtmlAttribute hrefAtt = n.Attributes["href"]; ListViewItem item = new ListViewItem(new string[] { n.InnerText.Trim(), hrefAtt.Value }); BookMarksList.Items.Add(item); } } #endregion //关闭读取文件流 sr.Close(); //关闭打开文件流 file.Close(); } catch (Exception ex){//错误处理 MessageBox.Show("文件打开错误:\n"+ex.ToString()); } } } } } ```
jqgrid获取不到后台数据,大神帮忙看一下
下面是 页面部分: ``` <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=urf-8"> <title>调度任务列表</title> <style type="text/css">@import url('${pageContext.request.contextPath}/styles/home.css'); .selected{ background:#F0F0F0;} @import url('${pageContext.request.contextPath}/css/jquery-ui-1.8.4.custom.css'); @import url('${pageContext.request.contextPath}/css/ui.jqgrid.css'); </style> <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.9.1.min.js"></script> <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-migrate-1.2.1.js"></script> <script type="text/javascript" src="${pageContext.request.contextPath}/js/grid.locale-zh_CN.js"></script> <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.jqGrid.min.js"></script> <script type="text/javascript" src="${pageContext.request.contextPath}/js/grid.custom.js"></script> <%-- <script type="text/javascript" src="${pageContext.request.contextPath}/js/common/triggerList.js"></script> --%> <script type="text/javascript"> $(function() { $("#tableList").jqGrid({ url : "${pageContext.request.contextPath}/JobProcessServlet?jobtype=100&action=query", // 提交的action地址 rownumbers : true, // 是否显示前面的行号 datatype : "json", // 返回的数据类型 mtype : "post", // 提交方式 height : "auto", // 表格宽度 autowidth : true, // 是否自动调整宽度 colNames:['Trigger 名称','Trigger 分组','下次执行时间','上次执行时间','优先级','Trigger 状态','Trigger 类型','开始时间','结束时间','操作'], colModel : [ { name : "display_name", index : "display_name", width : 60, sortable : true, align : 'center' }, { name : "trigger_group", index : "trigger_group", width : 60, sortable : true, align : 'center' }, { name : "next_fire_time", index : "next_fire_time", width : 60, sortable : true, align : 'center' }, { name : "prev_fire_time", index : "prev_fire_time", width : 60, sortable : true, align : 'center', }, { name : "priority", index : "priority", width : 60, sortable : true, align : 'center' }, { name : "statu", index : "statu", width : 60, sortable : true, align : 'center' }, { name : "trigger_type", index : "trigger_type", width : 60, sortable : true, align : 'center' }, { name : "start_time", index : "start_time", width : 60, sortable : true, align : 'center' }, { name : "end_time", index : "end_time", width : 60, sortable : true, hidden : true, align : 'center' } , { name : "process", index : "process", sortable : true, hidden : true, align : 'center' }], gridComplete : function() { $("#_empty", "#tableList") .addClass("nodrag nodrop"); $("#tableList").tableDnDUpdate(); var ids = jQuery("#tableList").jqGrid('getDataIDs'); for ( var i = 0; i < ids.length; i++) { var cl = ids[i]; update = "<input type='button' id='update' value='修改作业表达式' onclick='update(" + cl + ")'/>&nbsp;"; runOnce = "<input type='button' id='runOnce' value='立即执行一次' onclick='runOnce(" + cl + ")'/>&nbsp;"; pause = "<input type='button' id='runOnce' value='暂停' onclick='doCmd(" + cl + ")'/>&nbsp;"; recolve = "<input type='button' id='runOnce' value='恢复' onclick='doCmd(" + cl + ")'/>&nbsp;"; del = "<input type='button' id='runOnce' value='删除' onclick='doCmd(" + cl + ")'/>&nbsp;"; jQuery("#tableList").jqGrid('setRowData', ids[i], { process : update + runOnce + pause + recolve + del }); } }, viewrecords : true, sortname : "display_name", rowNum : 20, rowList : [10, 15, 20], prmNames : { search : "search" }, jsonReader : { root : "dataList", // 服务端保存数据的集合 repeatitems : false, page: "page", total: "total", records: "records", cell: "dataList", }, pager : "gridPager", hidegrid : false }); }); </script> </head> <body> <br><br> <table align="center" width="1100" border="0"> <tr> <td align="left"><a href="${pageContext.request.contextPath}/addTrigger.jsp">添加调度任务</a></td> </tr> <tr> <td align="left"><a href="${pageContext.request.contextPath}/logdb">查看作业日志表</a></td> </tr> <tr> <td align="left"><a href="${pageContext.request.contextPath}/compleData.htm">补数</a></td> </tr> </table> <div align="center" style="margin-bottom:5px"> <input type="button" id="update" style="margin-right:10px;" value="修改作业表达式" onclick="update()"> <input type="button" id="runOnce" style="margin-right:10px;" value="立即执行一次" onclick="runOnce()"> <input type="button" id="pause" style="margin-right:10px;" value="暂停" onclick="doCmd('pause')"> <input type="button" id="resume" style="margin-right:10px;" value="恢复" onclick="doCmd('resume')"> <input type="button" id="remove" style="margin-right:10px;" value="删除" onclick="doCmd('remove')"> </div> <table id="tableList"></table> <div id ="gridPager"></div> <%-- <table id="tableList" align="center" width="1100" border="1"> <tr> <th nowrap> 选择 </th> <th nowrap> Trigger 名称 </th> <th nowrap> Trigger 分组 </th> <th nowrap> 下次执行时间 </th> <th nowrap> 上次执行时间 </th> <th nowrap> 优先级 </th> <th nowrap> Trigger 状态 </th> <th nowrap> Trigger 类型 </th> <th nowrap> 开始时间 </th> <th nowrap> 结束时间 </th> <!-- <th nowrap> 动作命令 </th> --> </tr> <c:forEach var="map" items="${list}"> <tr align="center"> <td nowrap> <input type="checkbox" value="${map.trigger_name}"> </td> <td nowrap> ${map.display_name} </td> <td nowrap> ${map.trigger_group} </td> <td nowrap> ${map.next_fire_time} </td> <td nowrap> ${map.prev_fire_time} </td> <td nowrap> ${map.priority} </td> <td nowrap> ${map.statu} </td> <td nowrap> ${map.trigger_type} </td> <td nowrap> ${map.start_time} </td> <td nowrap> ${map.end_time} </td> <td nowrap> <input type="button" id="update" value="修改作业表达式" onclick="update('${map.trigger_name}','${map.job_name}')"> <input type="button" id="runOnce" value="立即执行一次" onclick="runOnce('${map.job_name}')"> <input type="button" id="pause" value="暂停" onclick="doCmd('pause','${map.trigger_name}','${map.trigger_group}','${map.trigger_state}')"> <input type="button" id="resume" value="恢复" onclick="doCmd('resume','${map.trigger_name}','${map.trigger_group}','${map.trigger_state}')"> <input type="button" id="remove" value="删除" onclick="doCmd('remove','${map.trigger_name}','${map.trigger_group}','${map.trigger_state}')"> </td> </tr> </c:forEach> </table> --%> </body> </html> 下面是java部分: private void getQrtzTriggers(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); List<Map<String, Object>> results = this.schedulerService .getQrtzTriggers(); String page = request.getParameter("page"); // 取得当前页数,注意这是jqgrid自身的参数 int rows = 20; int qrtzTriggers = this.schedulerService.countQrtzTriggers(); JSONObject json = new JSONObject(); json.put("dataList", results); json.put("records", qrtzTriggers);//总记录数 json.put("page", page); // 当前页 int total = qrtzTriggers/rows + ((qrtzTriggers%rows)>0?1:0); //计算得出的总页数 json.put("total", total); // 总页数 //System.out.println(rows); response.setCharacterEncoding("utf-8"); PrintWriter out = response.getWriter(); out.write(json.toString()); System.out.println(json.toString()); /*request.setAttribute("list", results);*/ request.getRequestDispatcher("/list.jsp").forward(request, response); } ```
(Java WEB)http-404,新手卡着好几天了。
最近改写别人的Java Web项目练习,遇到这个问题卡着两三天了。 ![图片说明](https://img-ask.csdn.net/upload/201705/10/1494384669_341338.png) 以下是JSP代码 ``` <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>left</title> <base target="body"/> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> <script type="text/javascript" src="<c:url value='/jquery/jquery-1.5.1.js'/>"></script> <script type="text/javascript" src="<c:url value='/menu/mymenu.js'/>"></script> <link rel="stylesheet" href="<c:url value='/menu/mymenu.css'/>" type="text/css" media="all"> <link rel="stylesheet" type="text/css" href="<c:url value='/jsps/css/left.css'/>"> <script language="javascript"> /* * 1. 对象名必须与第一个参数相同! 2. 第二个参数是显示在菜单上的大标题 */ var bar = new Q6MenuBar("bar", "仙林大学城网上书城"); $(function() { bar.colorStyle = 4;//指定配色样式,一共0,1,2,3,4 bar.config.imgDir = "<c:url value='/menu/img/'/>";//小工具所需图片的路径 bar.config.radioButton=true;//是否排斥,多个一级分类是否排斥 /* 1. 程序设计:一级分类名称 2. Java Javascript:二级分类名称 3. /goods/jsps/book/list.jsp:点击二级分类后链接到的URL 4. body:链接的内容在哪个框架页中显示 */ <c:forEach items="${parents}" var="parent"> <c:forEach items="${parent.children}" var="child"> bar.add("${parent.cname}", "${child.cname}", "/goods/BookServlet?method=findByCategory&cid=${child.cid}", "body"); </c:forEach> </c:forEach> $("#menu").html(bar.toString()); }); </script> </head> <body> <div id="menu"></div> </body> </html> ``` 以下servlet代码 ``` package cn.itcast.goods.book.web.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cn.itcast.commons.CommonUtils; import cn.itcast.goods.book.domain.Book; import cn.itcast.goods.book.service.BookService; import cn.itcast.goods.pager.PageBean; import cn.itcast.servlet.BaseServlet; public class BookServlet extends BaseServlet { private BookService bookService = new BookService(); /** * 获取当前页码 * * @param req * @return */ private int getPc(HttpServletRequest req) { int pc = 1; String param = req.getParameter("pc"); if (param != null && !param.trim().isEmpty()) { try { pc = Integer.parseInt(param); } catch (RuntimeException e) { } } return pc; } /** * 截取url,页面中的分页导航中需要使用它做为超链接的目标! * * @param req * @return */ /* * http://localhost:8080/goods/BookServlet?methed=findByCategory&cid=xxx&pc=3 * /goods/BookServlet + methed=findByCategory&cid=xxx&pc=3 */ private String getUrl(HttpServletRequest req) { String url = req.getRequestURI() + "?" + req.getQueryString(); /* * 如果url中存在pc参数,截取掉,如果不存在那就不用截取。 */ int index = url.lastIndexOf("&pc="); if (index != -1) { url = url.substring(0, index); } return url; } /** * 按bid查询 * * @param req * @param resp * @return * @throws ServletException * @throws IOException */ public String load(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String bid = req.getParameter("bid");//获取链接的参数bid Book book = bookService.load(bid);//通过bid得到book对象 req.setAttribute("book", book);//保存到req中 return "f:/jsps/book/desc.jsp";//转发到desc.jsp } /** * 按分类查 * * @param req * @param resp * @return * @throws ServletException * @throws IOException */ public String findByCategory(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { /* * 1. 得到pc:如果页面传递,使用页面的,如果没传,pc=1 */ int pc = getPc(req); /* * 2. 得到url:... */ String url = getUrl(req); /* * 3. 获取查询条件,本方法就是cid,即分类的id */ String cid = req.getParameter("cid"); /* * 4. 使用pc和cid调用service#findByCategory得到PageBean */ PageBean<Book> pb = bookService.findByCategory(cid, pc); /* * 5. 给PageBean设置url,保存PageBean,转发到/jsps/book/list.jsp */ pb.setUrl(url); req.setAttribute("pb", pb); return "f:/jsps/book/list.jsp"; } /** * 按作者查 * * @param req * @param resp * @return * @throws ServletException * @throws IOException */ public String findByAuthor(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { /* * 1. 得到pc:如果页面传递,使用页面的,如果没传,pc=1 */ int pc = getPc(req); /* * 2. 得到url:... */ String url = getUrl(req); /* * 3. 获取查询条件,本方法就是cid,即分类的id */ String author = req.getParameter("author"); /* * 4. 使用pc和cid调用service#findByCategory得到PageBean */ PageBean<Book> pb = bookService.findByAuthor(author, pc); /* * 5. 给PageBean设置url,保存PageBean,转发到/jsps/book/list.jsp */ pb.setUrl(url); req.setAttribute("pb", pb); return "f:/jsps/book/list.jsp"; } /** * 按出版社查询 * * @param req * @param resp * @return * @throws ServletException * @throws IOException */ public String findByPress(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { /* * 1. 得到pc:如果页面传递,使用页面的,如果没传,pc=1 */ int pc = getPc(req); /* * 2. 得到url:... */ String url = getUrl(req); /* * 3. 获取查询条件,本方法就是cid,即分类的id */ String press = req.getParameter("press"); /* * 4. 使用pc和cid调用service#findByCategory得到PageBean */ PageBean<Book> pb = bookService.findByPress(press, pc); /* * 5. 给PageBean设置url,保存PageBean,转发到/jsps/book/list.jsp */ pb.setUrl(url); req.setAttribute("pb", pb); return "f:/jsps/book/list.jsp"; } /** * 按图名查 * * @param req * @param resp * @return * @throws ServletException * @throws IOException */ public String findByBname(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { /* * 1. 得到pc:如果页面传递,使用页面的,如果没传,pc=1 */ int pc = getPc(req); /* * 2. 得到url:... */ String url = getUrl(req); /* * 3. 获取查询条件,本方法就是cid,即分类的id */ String bname = req.getParameter("bname"); /* * 4. 使用pc和cid调用service#findByCategory得到PageBean */ PageBean<Book> pb = bookService.findByBname(bname, pc); /* * 5. 给PageBean设置url,保存PageBean,转发到/jsps/book/list.jsp */ pb.setUrl(url); req.setAttribute("pb", pb); return "f:/jsps/book/list.jsp"; } /** * 多条件组合查询 * @param req * @param resp * @return * @throws ServletException * @throws IOException */ public String findByCombination(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { /* * 1. 得到pc:如果页面传递,使用页面的,如果没传,pc=1 */ int pc = getPc(req); /* * 2. 得到url:... */ String url = getUrl(req); /* * 3. 获取查询条件,本方法就是cid,即分类的id */ Book criteria = CommonUtils.toBean(req.getParameterMap(), Book.class); PageBean<Book> pb = bookService.findByCombination(criteria, pc); /* * 4. 使用pc和cid调用service#findByCategory得到PageBean */ /* * 5. 给PageBean设置url,保存PageBean,转发到/jsps/book/list.jsp */ pb.setUrl(url); req.setAttribute("pb", pb); return "f:/jsps/book/list.jsp"; } } ``` 以下是web.xml相关配置 ``` <servlet> <servlet-name>BookServlet</servlet-name> <servlet-class>cn.itcast.goods.book.web.servlet.BookServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>BookServlet</servlet-name> <url-pattern>/BookServlet</url-pattern> </servlet-mapping> ``` 相关文件位置 ![图片说明](https://img-ask.csdn.net/upload/201705/10/1494385059_583764.png)
用jQuery实现界面上某些按钮disabled
//js代码:获取当前星期,并且让id为Wed1和Wed2的submit disabled var dayNames = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); Stamp = new Date(); if(dayNames[Stamp.getDay()]=="Wed"){ document.write(dayNames[Stamp.getDay()]); $("#Wed1 input:submit").attr("disabled","true"); $("#Wed2 input:submit").attr("disabled","true"); } //div中list是遍历出来的,这样就导致Wed1和Wed2并不是唯一属性。所以这样写的jQuery并不好用 <div class="row feature"> <c:forEach items="${listWed }" varStatus="status" step="2"> <table> <tr> <td><img class="feature-image img-responsive" src="${listWed[status.index].image_name }"></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td> <td><img class="feature-image img-responsive" src="${listWed[status.index+1].image_name }"></td> </tr> <tr> <td align="center"><br/>${listWed[status.index].name }:${listWed[status.index].price }</td> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td> <td align="center"><br/>${listWed[status.index+1].name }:${listWed[status.index+1].price }</td> </tr> <tr> <td align="center"> <form id="Wed1" action="OrderAddServlet?id=${listWed[status.index].id }&email=<%=email %>" onsubmit="return checkLogin()" method="post"> <input type="submit" value="Order Now" style="color:#FF6600" > </form> </td> <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td> <td align="center"> <form id="Wed2" action="OrderAddServlet?id=${listWed[status.index].id }&email=<%=email %>" onsubmit="return checkLogin()" method="post"> <input type="submit" value="Order Now" style="color:#FF6600" > </form> </td> </tr> </table> </c:forEach> </div>
js代码转换为java~求大神指教,下面这段js怎么用java写出来
``` // 获取access_token,自动带缓存功能 function get_access_token($token = '', $update = false) { empty ( $token ) && $token = get_token (); $info = get_token_appinfo ( $token ); // 微信开放平台一键绑定 if ($token == 'gh_3c884a361561' || $info ['is_bind']) { $access_token = get_authorizer_access_token ( $info ['appid'], $info ['authorizer_refresh_token'], $update ); } else { $access_token = get_access_token_by_apppid ( $info ['appid'], $info ['secret'], $update ); } // 自动判断access_token是否已失效,如失效自动获取新的 if ($update == false) { $url = 'https://api.weixin.qq.com/cgi-bin/getcallbackip?access_token=' . $access_token; $res = wp_file_get_contents ( $url ); $res = json_decode ( $res, true ); if ($res ['errcode'] == '40001') { $access_token = get_access_token ( $token, true ); } } return $access_token; } // 获取当前用户的Token function get_token($token = NULL) { $stoken = session ( 'token' ); $reset = false; if ($token !== NULL && $token != '-1') { session ( 'token', $token ); $reset = true; } elseif (! empty ( $_REQUEST ['token'] ) && $_REQUEST ['token'] != '-1') { session ( 'token', $_REQUEST ['token'] ); $reset = true; } elseif (! empty ( $_REQUEST ['publicid'] )) { $publicid = I ( 'publicid' ); $token = D ( 'Common/Public' )->getInfo ( $publicid, 'token' ); $token && session ( 'token', $token ); $reset = true; } $token = session ( 'token' ); if (! empty ( $token ) && $token != '-1' && $stoken != $token && $GLOBALS ['is_wap']) { session ( 'mid', null ); } //加校验,防止使用无权限的公众号 /*if(!$GLOBALS['is_wap'] && $reset){ if(empty($GLOBALS['myinfo'])) $token = -1; else{ $sql = 'SELECT public_id FROM `'.C('DB_PREFIX').'public_link` as l LEFT JOIN '.C('DB_PREFIX').'public as p on l.mp_id=p.id WHERE l.uid='.$GLOBALS['mid']; $list = M()->query($sql); $flat = false; foreach ($list as $value) { if($value['public_id']==$token){ $flat = true; } } if(!$flat) $token = -1; } }*/ if (empty ( $token ) ) { $token = -1; } return $token; } // 获取公众号的信息 function get_token_appinfo($token = '', $field = '') { empty ( $token ) && $token = get_token (); if ($token != 'gh_3c884a361561') { $info = D ( 'Common/Public' )->getInfoByToken ( $token, $field ); } return $info; } function get_authorizer_access_token($appid, $refresh_token, $update) { if (empty ( $appid )) { return 0; } $key = 'authorizer_access_token_' . $appid; $res = S ( $key ); if ($res !== false && ! $update) return $res; $dao = D ( 'Addons://PublicBind/PublicBind' ); if (empty ( $refresh_token )) { $auth_code = $dao->_get_pre_auth_code (); $info = $dao->getAuthInfo ( $auth_code ); $authorizer_access_token = $info ['authorization_info'] ['authorizer_access_token']; } else { $info = $dao->refreshToken ( $appid, $refresh_token ); $authorizer_access_token = $info ['authorizer_access_token']; } if (! empty ( $authorizer_access_token )) { S ( $key, $authorizer_access_token, $info ['expires_in'] - 200 ); return $authorizer_access_token; } else { addWeixinLog ( $info, 'get_authorizer_access_token_fail_' . $appid ); return 0; } } function get_access_token_by_apppid($appid, $secret, $update = false) { if (empty ( $appid ) || empty ( $secret )) { return 0; } $key = 'access_token_apppid_' . $appid . '_' . $secret; $res = S ( $key ); if ($res !== false && ! $update) return $res; $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&secret=' . $secret . '&appid=' . $appid; $tempArr = json_decode ( get_data ( $url ), true ); if (@array_key_exists ( 'access_token', $tempArr )) { S ( $key, $tempArr ['access_token'], $tempArr ['expires_in'] ); return $tempArr ['access_token']; } else { return 0; } } // 防超时的file_get_contents改造函数 function wp_file_get_contents($url) { return get_data ( $url, 30 ); } // 以GET方式获取数据,替代file_get_contents function get_data($url, $timeout = 5) { $msg = $flat = ''; if (strpos ( $url, 'http://' ) !== false || strpos ( $url, 'https://' ) !== false) { $ch = curl_init (); curl_setopt ( $ch, CURLOPT_URL, $url ); curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, $timeout ); curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, FALSE ); // 跳过证书检查 curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, FALSE ); // 不检查证书 $res = curl_exec ( $ch ); $flat = curl_errno ( $ch ); if ($flat) { $msg = curl_error ( $ch ); } curl_close ( $ch ); } else { $context = stream_context_create ( array ( 'http' => array ( 'timeout' => 30 ) ) ); // 超时时间,单位为秒 $res = file_get_contents ( $url, 0, $context ); } return $res; } ``` ``` ```
thinkphp3.1Call to a member function get() on null
## 请大家先看一下下面的问题,帮忙解决一下,谢谢啦! *本地搭建的php+nginx环境,thinkphp3.1的框架。* ``` Call to a member function get() on null D:\phpStudy\WWW\qj\ThinkPHP\Extend\Driver\TagLib\TagLibGyfx.class.php 第 589 行. 错误位置 FILE: D:\phpStudy\WWW\qj\ThinkPHP\Lib\Core\Think.class.php  LINE: 277 TRACE [17-02-25 08:51:02] D:\phpStudy\WWW\qj\ThinkPHP\Lib\Core\Think.class.php (277) halt(Call to a member function get() on null D:\phpStudy\WWW\qj\ThinkPHP\Extend\Driver\TagLib\TagLibGyfx.class.php 第 589 行.) [17-02-25 08:51:02] D:\phpStudy\WWW\qj\ThinkPHP\Lib\Core\Think.class.php (292) Think::appError(1, Call to a member function get() on null, D:\phpStudy\WWW\qj\ThinkPHP\Extend\Driver\TagLib\TagLibGyfx.class.php, 589) [17-02-25 08:51:02] () Think::fatalError() ThinkPHP3.1.2 { Fast & Simple OOP PHP Framework } -- [ WE CAN DO IT JUST THINK ] ``` _本地自定义标签文件目录_: D:\phpStudy\WWW\qj\ThinkPHP\Extend\Driver\TagLib\TagLibGyfx.class.php ![图片说明](https://img-ask.csdn.net/upload/201702/25/1487985998_800094.png) _问题所在代码_: ``` /** * 自定义主导航标签 * <gyfx:navigation name='navigation' row='8' position="middle"></gyfx:navigation> * @param type $attr * @param type $content */ public function _navigation($attr, $content){ $parseStr = ''; $tag = $this->parseXmlAttr($attr, 'navigation'); //dump($tag);die(); $name = $tag['name']; $row = !empty($tag['row']) ? $tag['row'] : '12'; $position = !empty($tag['position']) ? $tag['position'] : 'top'; //实例化缓存 if(C('DATA_CACHE_TYPE') == 'MEMCACHED' && C('MEMCACHED_OCS') == true){ $memcaches = new Cacheds(); }else{ $memcaches = new Caches(); } //生成一个用来保存 namespace 的 key if($memcaches->getStat()){ $ns_key = $memcaches->C()->get(CI_SN."_namespace_key"); //如果 key 不存在,则创建,默认使用当前的时间戳作为标识 if($ns_key===false) $memcaches->C()->set(CI_SN."_namespace_key",time()); } //根据tag获取缓存key $cache_key = json_encode($tag).CI_SN; $cache_key = $ns_key.$cache_key; if($memcaches->getStat() && ini_get('memcache.allow_failover')&& $ary_return = $memcaches->C()->get($cache_key)){ $list = json_decode($ary_return,true); }else{ $list = D("Nav")->where(array('n_status'=>'1','n_position'=>$position)) ->field('n_id as nid,n_name as nname,n_url as nurl,n_target as ntarget, n_order as norder ') ->order(array('n_order' => 'asc'))->limit($row)->select(); //处理数据 if(!empty($list) && is_array($list)){ foreach($list as &$slist){ if(strstr($slist['nurl'],"?")){ $slist['nurl'] = $slist['nurl'].'&name='.$slist['nname']; }else{ $slist['nurl'] = $slist['nurl']; } } } if($memcaches->getStat() && ini_get('memcache.allow_failover')){ $memcaches->C()->set($cache_key,json_encode($list)); } } $count = count($list); $str_list = var_export($list, true); $parseStr = $parseStr . "<?php $$name = " . $str_list . "; ?>"; $parseStr = $parseStr . "<?php \$nav_count = " . $count . "; ?>"; $parseStr = $parseStr . '<volist name="nav" id="' . $name . '" >' . $content . '</volist>'; return $parseStr; } ``` **第589行:$ns_key = $memcaches->C()->get(CI_SN."_namespace_key"); ![图片说明](https://img-ask.csdn.net/upload/201702/25/1487988247_940832.png) 我打印到那一步都是好的,再往下就出现题目的错误了。587行,我刚更新的截图 ![图片说明](https://img-ask.csdn.net/upload/201702/25/1487989128_745453.png)
C# 最短路径问题,取出最短路径Node编号
我参考[最短路径](http://www.cnblogs.com/zhuweisky/archive/2006/03/26/246677.html "")网页的代码实现寻找最短路径。 请问,如何将result中的passNodeID取出来并赋值到新数组? 谢谢大家!! 代码如下 public class Edge { public string StartNodeID; public string EndNodeID; public double Weight; //权值,代价 } public class Node { private string iD; private ArrayList edgeList;//Edge的集合--出边表 public Node(string id) { this.iD = id; this.edgeList = new ArrayList(); } #region property public string ID { get { return this.iD; } } public ArrayList EdgeList { get { return this.edgeList; } } #endregion } /// <summary> /// PassedPath 用于缓存计算过程中的到达某个节点的权值最小的路径 /// </summary> public class PassedPath { private string curNodeID; private bool beProcessed; //是否已被处理 private double weight; //累积的权值 private ArrayList passedIDList; //路径 public PassedPath(string ID) { this.curNodeID = ID; this.weight = double.MaxValue; this.passedIDList = new ArrayList(); this.beProcessed = false; } #region property public bool BeProcessed { get { return this.beProcessed; } set { this.beProcessed = value; } } public string CurNodeID { get { return this.curNodeID; } } public double Weight { get { return this.weight; } set { this.weight = value; } } public ArrayList PassedIDList { get { return this.passedIDList; } } #endregion } /// <summary> /// PlanCourse 缓存从源节点到其它任一节点的最小权值路径=》路径表 /// </summary> public class PlanCourse { private Hashtable htPassedPath; #region ctor public PlanCourse(ArrayList nodeList, string originID) { this.htPassedPath = new Hashtable(); Node originNode = null; foreach (Node node in nodeList) { if (node.ID == originID) { originNode = node; } else { PassedPath pPath = new PassedPath(node.ID); this.htPassedPath.Add(node.ID, pPath); } } if (originNode == null) { throw new Exception("The origin node is not exist !"); } this.InitializeWeight(originNode); } private void InitializeWeight(Node originNode) { if ((originNode.EdgeList == null) || (originNode.EdgeList.Count == 0)) { return; } foreach (Edge edge in originNode.EdgeList) { PassedPath pPath = this[edge.EndNodeID]; if (pPath == null) { continue; } pPath.PassedIDList.Add(originNode.ID); pPath.Weight = edge.Weight; } } #endregion public PassedPath this[string nodeID] { get { return (PassedPath)this.htPassedPath[nodeID]; } } } public class RoutePlanResult { public string[] passNodeID; //通过的点的ID public double pPathWeirht; //路径的权值 public RoutePlanResult(string[] passID, double weight) { passNodeID = passID; pPathWeirht = weight; } } /// <summary> /// RoutePlanner 提供图算法中常用的路径规划功能。 /// 2005.09.06 /// </summary> public class RoutePlanner { public RoutePlanner() { } #region Paln //获取权值最小的路径 public RoutePlanResult Paln(ArrayList nodeList, string originID, string destID) { PlanCourse planCourse = new PlanCourse(nodeList, originID); Node curNode = this.GetMinWeightRudeNode(planCourse, nodeList, originID); #region 计算过程 while (curNode != null) { PassedPath curPath = planCourse[curNode.ID]; foreach (Edge edge in curNode.EdgeList) { if (edge.EndNodeID == originID) continue; PassedPath targetPath = planCourse[edge.EndNodeID]; double tempWeight = curPath.Weight + edge.Weight; if (tempWeight < targetPath.Weight) { targetPath.Weight = tempWeight; targetPath.PassedIDList.Clear(); for (int i = 0; i < curPath.PassedIDList.Count; i++) { targetPath.PassedIDList.Add(curPath.PassedIDList[i].ToString()); } targetPath.PassedIDList.Add(curNode.ID); } } //标志为已处理 planCourse[curNode.ID].BeProcessed = true; //获取下一个未处理节点 curNode = this.GetMinWeightRudeNode(planCourse, nodeList, originID); } #endregion //表示规划结束 return this.GetResult(planCourse, destID); } #endregion #region private method #region GetResult //从PlanCourse表中取出目标节点的PassedPath,这个PassedPath即是规划结果 private RoutePlanResult GetResult(PlanCourse planCourse, string destID) { PassedPath pPath = planCourse[destID]; if (pPath.Weight == int.MaxValue) { RoutePlanResult result1 = new RoutePlanResult(null, int.MaxValue); return result1; } string[] passedNodeIDs = new string[pPath.PassedIDList.Count]; for (int i = 0; i < passedNodeIDs.Length; i++) { passedNodeIDs[i] = pPath.PassedIDList[i].ToString(); } RoutePlanResult result = new RoutePlanResult(passedNodeIDs, pPath.Weight); return result; } #endregion #region GetMinWeightRudeNode //从PlanCourse取出一个当前累积权值最小,并且没有被处理过的节点 private Node GetMinWeightRudeNode(PlanCourse planCourse, ArrayList nodeList, string originID) { double weight = double.MaxValue; Node destNode = null; foreach (Node node in nodeList) { if (node.ID == originID) { continue; } PassedPath pPath = planCourse[node.ID]; if (pPath.BeProcessed) { continue; } if (pPath.Weight < weight) { weight = pPath.Weight; destNode = node; } } return destNode; } #endregion #endregion } //[STAThread] static void Main(string[] args) { ArrayList nodeList = new ArrayList(); //***************** A Node ******************* Node aNode = new Node("A"); nodeList.Add(aNode); //A -> B Edge aEdge1 = new Edge(); aEdge1.StartNodeID = aNode.ID; aEdge1.EndNodeID = "B"; aEdge1.Weight = 10; aNode.EdgeList.Add(aEdge1); //A -> C Edge aEdge2 = new Edge(); aEdge2.StartNodeID = aNode.ID; aEdge2.EndNodeID = "C"; aEdge2.Weight = 20; aNode.EdgeList.Add(aEdge2); //A -> E Edge aEdge3 = new Edge(); aEdge3.StartNodeID = aNode.ID; aEdge3.EndNodeID = "E"; aEdge3.Weight = 30; aNode.EdgeList.Add(aEdge3); //***************** B Node ******************* Node bNode = new Node("B"); nodeList.Add(bNode); //B -> C Edge bEdge1 = new Edge(); bEdge1.StartNodeID = bNode.ID; bEdge1.EndNodeID = "C"; bEdge1.Weight = 5; bNode.EdgeList.Add(bEdge1); //B -> E Edge bEdge2 = new Edge(); bEdge2.StartNodeID = bNode.ID; bEdge2.EndNodeID = "E"; bEdge2.Weight = 10; bNode.EdgeList.Add(bEdge2); //***************** C Node ******************* Node cNode = new Node("C"); nodeList.Add(cNode); //C -> D Edge cEdge1 = new Edge(); cEdge1.StartNodeID = cNode.ID; cEdge1.EndNodeID = "D"; cEdge1.Weight = 30; cNode.EdgeList.Add(cEdge1); //***************** D Node ******************* Node dNode = new Node("D"); nodeList.Add(dNode); //***************** E Node ******************* Node eNode = new Node("E"); nodeList.Add(eNode); //C -> D Edge eEdge1 = new Edge(); eEdge1.StartNodeID = eNode.ID; eEdge1.EndNodeID = "D"; eEdge1.Weight = 20; eNode.EdgeList.Add(eEdge1); RoutePlanner planner = new RoutePlanner(); RoutePlanResult result = planner.Paln(nodeList, "A", "D"); planner = null; ``` ```
springmvc 参数传递问题
输入查询条件查询能够显示第一页查询结果,但是点击翻页出错, Required String parameter 'filename' is not present 参数无法获取,不知什么原因,求大神 jsp页面代码 ``` <script language="javascript" type="text/javascript" src="<%=request.getContextPath() %>/My97DatePicker/WdatePicker.js"></script> <% HttpSession s = request.getSession(); %> <%String s1=s.getAttribute("pagenum").toString(); String s2=s.getAttribute("pagesize").toString(); String s3=s.getAttribute("pagenow").toString(); String s4=s.getAttribute("num").toString(); int pagenum=Integer.parseInt(s1); int pagesize=Integer.parseInt(s2); int pagenow=Integer.parseInt(s3); int pagenow2=Integer.parseInt(s3)+1; int listnum=Integer.parseInt(s4); int liststep=5;//显示页码数 if (pagenum < pagenow) { pagenow = pagenum;//如果分页变量大总页数,则将分页变量设计为总页数 } if (pagenow <=0) { pagenow = 1;//如果分页变量小于1,则将分页变量设为1 } else if (pagenow >0) { pagenow = pagenow+1;//如果分页变量小于1,则将分页变量设为1 } int listbegin = (pagenow - (int) Math.ceil((double) liststep / 2));//从第几页开始显示分页信息 if (listbegin < 1) { //当前页-(总显示的页列表数/2) listbegin = 1; } int listend = (pagenow + liststep / 2)-1;//分页信息显示到第几页//当前页+(总显示的页列表数/2) if (listend > pagenum) { listend = pagenum + 1; } if(listnum<=10) { listend=1;} if(listend-listbegin+1>pagenum) { listend=pagenum;} if(listend>pagenum) { listend=pagenum;} %> <h4 align="center">上传任务管理</h4> ${pageaction} <form action="upload/searchByFileName2/<%=0 %>" method="post"> <table border="1" cellspacing="0" align="center"> <tr> <td colspan="2" align="center">查询</td> </tr> <tr> <td width="450px" align="center">文件名称:<input type="text" name="filename" value=${filename} ></td> <td width="450px" align="center"> 文件类型:<select name="filetype" > <option value="txt">txt</option> <option value="jpg">jpg</option> </select> </td> </tr> <tr> <td align="center" > 上传时间从:<input name="start" type="text" style="width: 180px;" onFocus="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"> </td> <td align="center"> 至:<input name="stop" type="text" style="width:180px;" onFocus="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})" /> </td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" value="查询" style="width:150px;height: 25px" />&nbsp;&nbsp; <input type="reset" value="重置" style="width:150px;height: 25px" > </td> </tr> </table> <font color="red"> ${errormessage}</font> <br> <table border="1px" cellpadding="0" cellspacing="0" align="center"> <tr> <th ><input type="checkbox" name="all" value="ds"/></th> <th >id</th> <th >文件名</th> <th >文件大小</th> <th >文件类型</th> <th >上传时间</th> <th >文件描述</th> <th >执行时间</th> <th >运行结果</th> <th >操作</th> </tr> <c:forEach var="upload" items="${upload}"> <tr> <td width="45px"><input type="checkbox" value="${upload.id}" name="single"/></td> <td width="45px">${upload.id}</td> <td width="235px">${upload.filename}</td> <td>${upload.filesize}</td> <td>${upload.filetype}</td> <td>${upload.uploaddate}</td> <td>${upload.des}</td> <td>${upload.runtime}</td> <td>${upload.result}</td> <td> <a href="">编辑</a> <a href="">删除</a><br /> </td> </tr> </c:forEach> <tr> <td align="right" colspan="10"> 当前第:<%=pagenow%>页/共<%=pagenum %>页 显示<%=pagesize %>条/共<%=listnum %>条 </td> </tr> <tr> <td align="center" colspan="10"> <% if (pagenow > 1) { %> <a href="${pageContext.request.contextPath}/${pageaction}/<%=pagenow-2 %>.html" style="text-decoration:none"> <% out.println("上一页"); }%> </a> <%for(int i=listbegin;i<=listend;i++) { pagenow=i; %> <a href="${pageContext.request.contextPath}/${pageaction}/<%=pagenow-1%>.html" style="text-decoration:none" > <% if(i==pagenow2) out.println("<font color='red'>["+i+"]</font>&nbsp;"); else out.println("["+i+"]&nbsp;"); } %> </a> <% if (pagenow !=pagenum) { %> <a href="${pageContext.request.contextPath}/${pageaction}/<%=pagenow2 %>.html" style="text-decoration:none"> <% if(listnum!=0) out.println("下一页"); }%> </a> </td> </tr> </table> </form> </body> </html> ``` jsp页面 ![图片说明](https://img-ask.csdn.net/upload/201511/11/1447217989_777414.png) controller代码 ``` @RequestMapping(value="/searchByFileName2/{pagenow}") public ModelAndView searchByFilename(HttpServletRequest request,@RequestParam String filename,@RequestParam String filetype,@RequestParam String start,@RequestParam String stop, ModelMap mod) throws ParseException { WebApplicationContext webApplicationContext = ContextLoader.getCurrentWebApplicationContext(); ServletContext application = webApplicationContext.getServletContext(); String n=(String) application.getAttribute("name"); System.out.println("sssssssssss "+n); System.out.println("***************filename"+filename); System.out.println("***************start"+start); System.out.println("***************stop"+stop); System.out.println("***************filetype"+filetype); ModelAndView modelAndView=new ModelAndView("user/uploadWithPage"); if(start.equals("")&!stop.equals("")) { mod.addAttribute("errormessage", "上传日期不能为空"); return modelAndView; } if(!start.equals("")&stop.equals("")) { mod.addAttribute("errormessage", "上传日期不能为空"); return modelAndView; } Page<Upload> uploa=null; if(filename.equals("")&start.equals("")&stop.equals("")) { uploa=uploadService.findUploadByUsernameAndFiletype(n, filetype, 0, pagesize); } else if(start.equals("")&stop.equals("")) { uploa=uploadService.findUploadByUsernameAndFilenameAndFiletype(n, filename, filetype, 0, pagesize); } else if(filename.equals("")&!start.equals("")&!stop.equals("")) { uploa=uploadService.findUploadByUsernameAndFileTypeAndUploaddate(n, filetype, start, stop, 0, pagesize); } else if(!filename.equals("")&!start.equals("")&!stop.equals("")) { uploa=uploadService.findUploadByAll(n, filename, filetype, start, stop, 0, pagesize); } else { mod.addAttribute("errormessage", "上传日期不能为空"); } //当前页查询的记录数 pageitems=uploa.getNumberOfElements(); //查询出的总记录数 itemsnum=(int)uploa.getTotalElements(); //总页数 pagenum=uploa.getTotalPages(); HttpSession session = getSession(); session.setAttribute("pagenum", pagenum); session.setAttribute("pagesize", pagesize); session.setAttribute("num", itemsnum); session.setAttribute("pagenow", pagenow); session.setAttribute("filename", filename); session.setAttribute("filetype", filetype); session.setAttribute("start", start); session.setAttribute("stop", stop); mod.addAttribute("filename", filename); List<Upload> u = uploa.getContent(); if(u.size()==0) { mod.addAttribute("errormessage", "该文件不存在"); return modelAndView; } mod.addAttribute("pageaction", "upload/searchByFileName2"); modelAndView.addObject("upload",u); return modelAndView; } ```
微信平台酒店预订模块实现订单发邮箱功能,请教
微淘微信营销平台中的酒店预订模块,希望实现订单发送到指定邮箱功能,但不知道怎样添加代码了! 原代码中有个“微订餐”是已经实现订单发送到邮箱功能的,但是修改酒店预订的总是不成功,希望大神能帮看看。 第一张代码是微订餐的,第二个是想要修改的微酒店的 ........................................................... 一:微订餐 <?php class DiningAction extends BaseAction{ public $token; public $wecha_id; public $dining_model; public $dining_cat_model; public $isDining; public function __construct(){ parent::_initialize(); $agent = $_SERVER['HTTP_USER_AGENT']; if(!strpos($agent,"MicroMessenger")) { // echo '此功能只能在微信浏览器中使用';exit; } $this->token = $this->_get('token'); $this->assign('token',$this->token); $this->wecha_id = $this->_get('wecha_id'); if (!$this->wecha_id){ $this->wecha_id=''; } $this->assign('wecha_id',$this->wecha_id); $this->dining_model=M('Dining'); $this->dining_cat_model=M('Dining_cat'); $this->assign('staticFilePath',str_replace('./','/',THEME_PATH.'common/weidingcan')); //订单类型 if (isset($_GET['dtype'])){ $dtype=$this->_get('dtype'); $_SESSION['dtype']=$dtype; }else{ $dtype=$_SESSION['dtype']; } $this->assign('dtype',$dtype); //是否是餐饮 $this->isDining=1; $this->assign('isDining',1); //公司信息 $this->company_model=M('Dining_company'); if (isset($_GET['setid'])){ $setid=$this->_get('setid'); $_SESSION['setid']=$setid; }else{ $setid=$_SESSION['setid']; } if($setid){ $this->assign('setid',$setid); //店铺信息 $setinfos=$this->company_model->where(array('id'=>$setid))->find(); $this->company=M('Company')->where(array('id'=>$setinfos['catid']))->find(); //如果是分店 if($this->company['isbranch']){ $this->top_company=M('Company')->where(array('id'=>$setinfos['catid'],'isbranch'=>0))->find(); } $metaTitle=$this->company; $this->assign('company',$this->company); $this->assign('top_company',$this->top_company); $this->assign('setinfos',$setinfos); } } function remove_html_tag($str){ //清除HTML代码、空格、回车换行符 //trim 去掉字串两端的空格 //strip_tags 删除HTML元素 $str = trim($str); $str = @preg_replace('/<script[^>]*?>(.*?)<\/script>/si', '', $str); $str = @preg_replace('/<style[^>]*?>(.*?)<\/style>/si', '', $str); $str = @strip_tags($str,""); $str = @ereg_replace("\t","",$str); $str = @ereg_replace("\r\n","",$str); $str = @ereg_replace("\r","",$str); $str = @ereg_replace("\n","",$str); $str = @ereg_replace(" ","",$str); $str = @ereg_replace("&nbsp;","",$str); return trim($str); } public function cats(){ $catWhere=array('parentid'=>0,'token'=>$this->token); if (isset($_GET['parentid'])){ $parentid=intval($_GET['parentid']); $catWhere['parentid']=$parentid; $thisCat=$this->dining_cat_model->where(array('id'=>$parentid))->find(); $this->assign('thisCat',$thisCat); $this->assign('parentid',$parentid); } $cats = $this->dining_cat_model->where($catWhere)->order('id asc')->select(); $this->assign('cats',$cats); $where=array('token'=>$this->token); if (isset($_GET['catid'])){ $catid=intval($_GET['catid']); $where['catid']=$catid; $thisCat=$this->dining_cat_model->where(array('id'=>$catid))->find(); $this->assign('thisCat',$thisCat); if (IS_POST){ $key = $this->_post('search_name'); $url=U('Dining/cats',array('token'=>$this->token,'wecha_id'=>$this->wecha_id,'keyword'=>$key)); $this->redirect($url); } if (isset($_GET['keyword'])){ $where['name|intro|keyword'] = array('like',"%".$_GET['keyword']."%"); $this->assign('isSearch',1); } $count = $this->dining_model->where($where)->count(); $this->assign('count',$count); //排序方式 $method=isset($_GET['method'])&&($_GET['method']=='DESC'||$_GET['method']=='ASC')?$_GET['method']:'DESC'; $orders=array('time','discount','price','salecount'); $order=isset($_GET['order'])&&in_array($_GET['order'],$orders)?$_GET['order']:'time'; $this->assign('order',$order); $this->assign('method',$method); // $products = $this->dining_model->where($where)->order($order.' '.$method)->select(); }else{ $products = $this->dining_model->where($where)->select(); } //格式化简介 foreach($products as $k=>$v){ $products[$k]['intro']=$this->remove_html_tag($v['intro']); } $this->assign('products',$products); $metaTitle2=$this->metaTitle; $metaTitle=$metaTitle2['name']; $this->assign('metaTitle',$metaTitle); $this->display('caipu'); } public function header(){ $this->display(); } public function about(){ //店铺信息 $company_model=M('Dining_company'); $thisCompany=$company_model->where(array('token'=>$this->token,'id'=>$_GET['setid']))->find(); $Company=M('Company')->where(array('token'=>$this->token,'id'=>$thisCompany['catid']))->find(); $this->assign('thisCompany',$thisCompany); $this->assign('Company',$Company); $this->assign('metaTitle',"店铺介绍"); //轮换图 $flash=M('Flash')->where($where)->select(); $count=count($flash); $this->assign('flash',$flash); $this->display('dianpujieshao'); } public function calCartInfo($carts=''){ $totalFee=0; $totalCount=0; if (!$carts){ if (!isset($_SESSION['session_cart_products'])||!strlen($_SESSION['session_cart_products'])){ $carts=array(); }else { $carts=unserialize($_SESSION['session_cart_products']); } } if ($carts){ foreach ($carts as $c){ if ($c){ $totalFee+=floatval($c['price'])*$c['count']; $totalCount+=intval($c['count']); } } } return array($totalCount,$totalFee); } function _getCart(){ if (!isset($_SESSION['session_cart_products'])||!strlen($_SESSION['session_cart_products'])){ $carts=array(); }else { $carts=unserialize($_SESSION['session_cart_products']); } return $carts; } public function cart(){ $totalFee=0; $totalCount=0; $products=array(); $ids=array(); $carts=$this->_getCart(); foreach ($carts as $k=>$c){ if (is_array($c)){ $productid=$k; $price=$c['price']; $count=$c['count']; // if (!in_array($productid,$ids)){ array_push($ids,$productid); } $totalFee+=$price*$count; $totalCount+=$count; } } if (count($ids)){ $list=$this->dining_model->where(array('id'=>array('in',$ids)))->select(); } //判断是不是餐饮 if ($list){ $i=0; foreach ($list as $p){ $list[$i]['count']=$carts[$p['id']]['count']; $i++; } } $this->assign('products',$list); //获取个人信息 $userinfo_model=M('Userinfo'); $thisUser=$userinfo_model->where(array('token'=>$this->token,'wecha_id'=>$this->wecha_id))->find(); $this->assign('thisUser',$thisUser); //获取时间 $diningConfig =M('Reply_info')->where(array('infotype'=>'Dining','token'=>$this->token))->find(); $this->assign('diningConfig',$diningConfig); //可以预定多少天内的 $diningConfigDetail=unserialize($diningConfig['config']); if (!$diningConfigDetail||!$diningConfigDetail['yudingdays']){ $days=7; }else { $days=$diningConfigDetail['yudingdays']; } $time=time(); $secondsOfDay=24*60*60; $dateTimes=array(); for ($i=0;$i<$days;$i++){ array_push($dateTimes,$time+$i*$secondsOfDay); } $this->assign('dateTimes',$dateTimes); // $orderHour=date('H',$time); $this->assign('orderHour',$orderHour); $hours=array(); for ($i=0;$i<24;$i++){ array_push($hours,$i); } $this->assign('hours',$hours); //获取桌台信息 $dining_diningtable_model=M('Dining_diningtable'); $tables=$dining_diningtable_model->where(array('token'=>$_GET['token']))->order('taxis ASC')->select(); $this->assign('tables',$tables); // $this->assign('totalCount',$totalCount); $this->assign('totalFee',$totalFee); $_SESSION['formhash']=md5($time); $this->assign('formhash',md5($time)); $this->assign('metaTitle',"下订单"); $this->display('gouwuche'); } public function dingdanpost(){ //查询当前会员信息 $userinfo_model=M('Userinfo'); $thisUser=$userinfo_model->where(array('token'=>$this->token,'wecha_id'=>$this->wecha_id))->find(); $this->assign('thisUser',$thisUser); //提交 if (IS_POST){ //商品信息 $goodsData=$this->_post('goodsData'); $arr = array_filter(explode(';',$goodsData)); if(empty($arr)){ $this->error('购物车为空!'); } foreach ($arr as $k=>$v){ $p = explode(',',$v); $carts[$p[0]]=array('count'=>$p[2],'price'=>$p[1]); } //订单信息 $totalFee=$this->_post('price'); $productids=array(); foreach ($carts as $k=>$c){ array_push($productids,$k); } //订单号 $orderid=date("YmdHis").rand(1000,2000); $row=array(); $row['diningtype']=$this->_post('diningtype'); $row['orderid']=$orderid; //联系资料 $row['truename']=$this->_post('truename'); $row['tel']=$this->_post('tel'); $row['address']=$this->_post('address'); $row['token']=$this->token; $row['wecha_id']=$this->wecha_id; //支付方式 $row['payment']=$this->_post('payment'); $buytimestamp=$this->_post('buytimestamp');//购买时间 if ($buytimestamp){ $row['year']=date('Y',$buytimestamp); $row['month']=date('m',$buytimestamp); $row['day']=date('d',$buytimestamp); $row['hour']=$this->_post('hour'); } $row['time']=time(); //加入订餐订单 $dining_cart_model=M('Product_cart');; $calCartInfo=$this->calCartInfo($carts); $row['total']=$calCartInfo[0]; $row['price']=$calCartInfo[1]; // $row['diningtype']=intval($this->_post('diningtype')); $row['buytime']=$buytimestamp?$row['month'].'月'.$row['day'].'日'.$row['hour'].'点':''; $row['tableid']=intval($this->_post('tableid')); $row['info']=serialize($carts); // $row['groupon']=0; $row['dining']=1; $order_id=$dining_cart_model->add($row); if(empty($order_id)){ $this->error('订单提交失败'); } //订单商品列表 $dining_model=M('Dining'); $dining_cart_list_model=M('Product_cart_list'); $crow=array(); foreach ($carts as $k=>$c){ $crow['cartid']=$order_id; $crow['productid']=$k; $crow['price']=$c['price']; $crow['total']=$c['count']; $crow['wecha_id']=$row['wecha_id']; $crow['token']=$row['token']; $crow['time']=time(); $dining_cart_list_model->add($crow); $dining_model->where(array('id'=>$k))->setInc('salecount',$c['count']); } //保存个人信息 $userRow=array('tel'=>$row['tel'],'truename'=>$row['truename'],'address'=>$row['address']); if ($thisUser){ $userinfo_model->where(array('id'=>$thisUser['id']))->save($userRow); }else { $userRow['token']=$this->token; $userRow['wecha_id']=$this->wecha_id; $userRow['wechaname']=''; $userRow['qq']=0; $userRow['sex']=-1; $userRow['age']=0; $userRow['birthday']=''; $userRow['info']=''; $userRow['total_score']=0; $userRow['sign_score']=0; $userRow['expend_score']=0; $userRow['continuous']=0; $userRow['add_expend']=0; $userRow['add_expend_time']=0; $userRow['live_time']=0; $userinfo_model->add($userRow); } //下单成功后处理 if($row['payment']==1){ /*$url='https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token='.$this->token; $data='{"touser":"'.$this->wecha_id.'","msgtype":"text","text":{"content":"'.$re_msg.'"}}'; if($this->api_curl_post($url,$data)==false){ echo $url;exit; }*/ $cominfo=$this->company; // 给客户发送短信 $info=M('wxuser')->where(array('token'=>$this->token))->find(); $phone=$row['tel']; $user=$info['smsuser'];//短信平台帐号 $pass=md5($info['smspassword']);//短信平台密码 $smsstatus=$info['smsstatus'];//短信平台状态 $content =$row['truename']." 您好,您在".$cominfo['name']."的订单将在30分钟内送到,合计:".$totalFee." 元,"; $content .="送餐查询:".$cominfo['tel'].",感谢您的预订!"; if ($user && $smsstatus == 1 && $content) { $smsrs = file_get_contents('http://api.smsbao.com/sms?u='.$user.'&p='.$pass.'&m='.$phone.'&c='.urlencode($content)); } //给管理员发邮件通知 $to_email=$info['email']; $emailuser=$info['emailuser']; $emailpassword=$info['emailpassword']; $emailstatus=$info['emailstatus']; if ($emailstatus == 1&&$emailuser) { $subject="您有新的订单,单号:".$orderid.",预定人:".$row['truename']; $body="预定店铺:".$this->company['name']."<br>".$this->email_body(); $this->send_email($subject,$body,$emailuser,$emailpassword,$to_email); } // 结束 $this->success('下单成功!',U('Dining/dingdan',array('token'=>$this->token,'wecha_id'=>$this->wecha_id,'success'=>1))); } } } public function my(){ if(IS_POST){ $row['wechaname']=$this->_post('wechaname'); $row['truename']=$this->_post('truename'); $row['tel']=$this->_post('tel'); $row['address']=$this->_post('address'); $row['token']=$this->token; $row['wecha_id']=$this->wecha_id; if (!$row['wecha_id']){ $row['wecha_id']='null'; } $userinfo_model=M('Userinfo'); $where=array('token'=>$this->token,'wecha_id'=>$this->wecha_id); if($where){ $thisUser=$userinfo_model->where($where)->save($row); }else{ $thisUser=$userinfo_model->where($where)->add($row); } if($thisUser){ $this->success('成功',U('Dining/my',array('token'=>$this->token,'wecha_id'=>$this->wecha_id))); }else{ $this->error('操作失败,请稍候再试'); } }else{ $userinfo_model=M('Userinfo'); $thisUser=$userinfo_model->where(array('token'=>$this->token,'wecha_id'=>$this->wecha_id))->find(); $this->assign('thisUser',$thisUser); //$this->assign('metaTitle','我的资料'); $metaTitle2=$this->metaTitle; $metaTitle=$metaTitle2['name']; $this->assign('metaTitle',$metaTitle); $this->display('gerenziliao'); } } public function dingdan(){ $dining_cart_model=M('Product_cart');; $where['token']=$this->token; $where['wecha_id']=$this->wecha_id; $where['_string'] = 'dining=1 AND groupon=0'; $orders=$dining_cart_model->where($where)->order('time DESC')->select(); $this->assign('orders',$orders); $this->assign('ordersCount',count($orders)); $this->assign('metaTitle','我的订单'); $this->display('dingdan'); } public function xiangqing(){ $dining_cart_model=M('Product_cart');; $thisOrder=$dining_cart_model->where(array('id'=>intval($_GET['id']),'wecha_id'=>$this->wecha_id))->find(); $this->assign('thisOrder',$thisOrder); $dining_diningtable_model=M('Dining_diningtable'); $tables=$dining_diningtable_model->where(array('id'=>$thisOrder['tableid']))->find(); $this->assign('tables',$tables); $carts=unserialize($thisOrder['info']); $totalFee=$thisOrder['price']; $totalCount=$thisOrder['total']; $products=array(); $ids=array(); foreach ($carts as $k=>$c){ if (is_array($c)){ $productid=$k; if (!in_array($productid,$ids)){ array_push($ids,$productid); } } } if (count($ids)){ $list=$this->dining_model->where(array('id'=>array('in',$ids)))->select(); } if ($list){ $i=0; foreach ($list as $p){ $list[$i]['count']=$carts[$p['id']]['count']; if ($i==0){ $orderName=$p['name']; }else{ $orderName .="|".$p['name']; }$i++; } } $this->assign('products',$list); $this->assign('totalFee',$totalFee); $this->assign('orderName',$orderName); $this->assign('totalCount',$totalCount); $this->assign('metaTitle','订单详情'); $this->display('xiangqing'); } public function deleteOrder(){ $dining_model=M('Dining'); $dining_cart_model=M('Product_cart');; $dining_cart_list_model=M('Product_cart_list'); $dining=$_GET['dining']; $thisOrder=$dining_cart_model->where(array('id'=>intval($_GET['id'])))->find(); //检查权限 $id=$thisOrder['id']; if ($thisOrder['wecha_id'] !=$this->wecha_id || $thisOrder['handled']==1){ $this->error('操作失败,请稍候再试'); } // //删除订单和订单列表 $dining_cart_model->where(array('id'=>$id))->delete(); $dining_cart_list_model->where(array('cartid'=>$id))->delete(); //商品销量做相应的减少 $carts=unserialize($thisOrder['info']); foreach ($carts as $k=>$c){ if (is_array($c)){ $productid=$k; $price=$c['price']; $count=$c['count']; $dining_model->where(array('id'=>$k))->setDec('salecount',$c['count']); } } $this->redirect(U('Dining/dingdan',array('token'=>$_GET['token'],'wecha_id'=>$_GET['wecha_id'],'dining'=>1))); } public function index(){ //查询总店信息 $Company=M('Company')->where(array('token'=>$this->token,'isbranch'=>0))->find(); //查询首页配置 $Reply_info=M('Reply_info')->where(array('token'=>$this->token,'infotype'=>'Dining'))->find(); $this->assign('logourl',$Company['logourl']); $this->assign('homepic',$Reply_info['homepic']); $this->assign('metaTitle','订餐首页'); $this->display('index'); } public function stores(){ $token_open=M('token_open')->field('queryname')->where(array('token'=>$this->token))->find(); $this->assign('diningOpen',1); if(!strpos($token_open['queryname'],'dx')){ $this->assign('diningOpen',0); } $company_model=M('Dining_company'); $branchStores=$company_model->where(array('token'=>$this->token))->select(); foreach ($branchStores as $k=>$c){ $catid=$c['catid']; $thisCompany=M('Company')->where(array('id'=>$catid))->find(); $branchStores[$k]['name']=$thisCompany['name']; $branchStores[$k]['logourl']=$thisCompany['logourl']; $branchStores[$k]['tel']=$thisCompany['tel']; $branchStores[$k]['latitude']=$thisCompany['latitude']; $branchStores[$k]['longitude']=$thisCompany['longitude']; $branchStores[$k]['address']=$thisCompany['address']; } $branchStoreCount=count($branchStores); $this->assign('branchStoreCount',$branchStoreCount); $this->assign('branchStores',$branchStores); $this->assign('metaTitle','店铺列表'); $this->display('shangjiaxinxi'); } public function dining(){ //是否外卖预定等 $diningConfig =M('Reply_info')->where(array('infotype'=>'Dining','token'=>$this->token))->find(); $this->assign('diningConfig',$diningConfig); //$this->assign('metaTitle','订餐'); $metaTitle2=$this->metaTitle; $metaTitle=$metaTitle2['name']; $this->assign('metaTitle',$metaTitle); $this->display(); } /** * 检查某时间段内是否已经有和桌子被预定 * */ public function ajaxTables(){ $token=$this->_get('token'); $time=$this->_get('time'); $hour=intval($this->_get('hour')); $year=date('Y',$time); $month=date('m',$time); $day=date('d',$time); $occupiedTables=array(); $dining_cart_model=M('Product_cart');; $otableWhere=array(); $otableWhere['token']=$token; $otableWhere['hour']=array('between',array($hour-3,$hour+3));//三个小时内不能再定 $otableWhere['year']=$year; $otableWhere['month']=$month; $otableWhere['day']=$day; $otables=$dining_cart_model->where($otableWhere)->select(); $str=''; $comma=''; if ($otables){ foreach ($otables as $t){ if (!in_array($t['tableid'],$occupiedTables)){ $str.=$comma.$t['tableid']; array_push($occupiedTables,$t['tableid']); $comma=','; } } } echo $str; } //模拟post提交 public function api_curl_post($url, $data){ $ch = curl_init(); $header = "Accept-Charset: utf-8"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)'); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $tmpInfo = curl_exec($ch); if (curl_errno($ch)) { return false; }else{ return true; } } //订单内容 public function email_body(){ $where['token']=$this->token; $where['wecha_id']=$this->wecha_id; $where['printed']=0; $this->product_model=M('dining'); $this->product_cart_model=M('product_cart'); $count= $this->product_cart_model->where($where)->count(); $orders=$this->product_cart_model->where($where)->order('time DESC')->limit(0,1)->select(); $now=time(); if ($orders){ $thisOrder=$orders[0]; switch ($thisOrder['diningtype']){ case 0: $orderType='购物'; break; case 1: $orderType='点餐'; break; case 2: $orderType='外卖'; break; case 3: $orderType='预定'; break; } //订餐信息 $product_diningtable_model=M('product_diningtable'); if ($thisOrder['tableid']) { $thisTable=$product_diningtable_model->where(array('id'=>$thisOrder['tableid']))->find(); $thisOrder['tableName']=$thisTable['name']; }else{ $thisOrder['tableName']='未指定'; } $str="订单类型:".$orderType."\r\n订单编号:".$thisOrder['orderid']."\r\n姓名:".$thisOrder['truename']."\r\n电话:".$thisOrder['tel']."\r\n地址:".$thisOrder['address']."\r\n下单时间:".date('Y-m-d H:i:s',$thisOrder['time'])."<br>"; //订单详情 $carts=unserialize($thisOrder['info']); $totalFee=0; $totalCount=0; $products=array(); $ids=array(); foreach ($carts as $k=>$c){ if (is_array($c)){ $productid=$k; $price=$c['price']; $count=$c['count']; if (!in_array($productid,$ids)){ array_push($ids,$productid); } $totalFee +=$price*$count; $totalCount +=$count; } } if (count($ids)){ $products=$this->product_model->where(array('id'=>array('in',$ids)))->select(); } if ($products){ $i=0; foreach ($products as $p){ $products[$i]['count']=$carts[$p['id']]['count']; $str .=$p['name']." ".$products[$i]['count']."份 单价:".$p['price']."元\r\n"; $i++; } } $str .="合计:".$thisOrder['price']."元"; return $str; }else { return ''; } } //发邮件函数 public function send_email($Subject,$body,$emailuser,$emailpassword,$to_email){ date_default_timezone_set('PRC'); require_once 'class.phpmailer.php'; include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = 'smtp.163.com'; // SMTP server $mail->SMTPDebug = '1'; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPAuth = true; // enable SMTP authentication $mail->Port = 25; // set the SMTP port for the GMAIL server $mail->Username = "邮箱"; // SMTP account username $mail->Password = "邮箱密码"; // SMTP account password $mail->From = "邮箱"; // 发件人邮箱 $mail->FromName = "管理员"; // 发件人 //$mail->AddAddress($to_email, '商户'); $mail->AddReplyTo("邮箱",'微订餐'); $mail->Subject = $Subject; $mail->IsHTML(true); // send as HTML // optional, comment out and test $mail->MsgHTML($body); $to_email_arr=explode(",",$to_email); foreach($to_email_arr as $k => $v){ $mail->AddAddress($v, '商户'); } return($mail->Send()); } } ?> .................................................. 二:微酒店代码 <?php //wap class JiudianAction extends BaseAction{ public $token; public $wecha_id; public $Yuyue_model; public $yuyue_order; public function __construct(){ parent::__construct(); $this->token=session('token'); // $this->token = $this->_get('token'); $this->assign('token',$this->token); $this->wecha_id = $this->_get('wecha_id'); if (!$this->wecha_id){ $this->wecha_id='null'; } $this->assign('wecha_id',$this->wecha_id); $this->Yuyue_model=M('yuyue'); $this->yuyue_order=M('yuyue_order'); $this->type='Jiudian'; } //预约列表 public function index(){ $pid = $this->_get('id'); $wecha_id = $this->_get('wecha_id'); $where = array('token'=> $this->_get('token'),'id'=>$pid); $data = $this->Yuyue_model->where($where)->find(); $info = M('yuyue_setcin')->where(array('pid'=>$pid,'type'=>$this->type))->select(); //print_r($info);die; $data['count'] = $this->yuyue_order->where(array('wecha_id'=> $wecha_id,'pid'=>$pid))->count(); $data['token'] = $this->_get('token'); $data['wecha_id'] = $wecha_id; //print_r($str);die; $this->assign('data', $data); $this->assign('info', $info); $this->display(); } public function info(){ $pid = $this->_get('id'); $id = $this->_get('aid'); $where = array('token'=> $this->_get('token'),'id'=>$pid); $cast = array( 'token'=> $this->_get('token'), 'wecha_id'=> $this->_get('wecha_id') ); $info = M('yuyue_setcin')->where(array('id'=>$id))->find(); $info['sheng']=$info['yuanjia']-$info['youhui']; $data = $this->Yuyue_model->where($where)->find(); for($i=1;$i<6;$i++){ if(!empty($info['pic'.$i])){ $info['pic'][]=$info['pic'.$i]; unset($info['pic'.$i]); } } //print_r($data);print_r($info);die; $data['token'] = $this->_get('token'); $data['wecha_id'] = $this->_get('wecha_id'); $wap= M('setinfo')->where(array('pid'=>$pid))->select(); $str=array(); //print_r($wap);die; foreach($wap as $v){ if($v['kind']==5){ $str["message"]=$v["name"]; }else{ $str[$v["name"]]=$v["value"]; } } //print_r($str);die; $arr= M('setinfo')->where(array('kind'=>'3','pid'=>$pid))->select(); $list= M('setinfo')->where(array('kind'=>'4','pid'=>$pid))->select(); $i=0; foreach($list as $v){ $list[$i]['value']= explode("|",$v['value']); $i++; } //print_r($list);die; $this->assign('str', $str); $this->assign('arr',$arr); $this->assign('list',$list); $this->assign('data', $data); $this->assign('info', $info); $this->display(); } //添加订单 public function add(){ //print_r($_POST());die; if(IS_POST){ $url = U($this->type.'/order',array('token'=>$_POST['token'], 'wecha_id'=>$_POST['wecha_id'],'id'=>$_POST['pid'],)); $url = substr($url,1); //$url = U($this->type.'/order',array('token'=>$this->$_POST['token'], 'wecha_id'=>$_POST['wecha_id'],$id=>$_POST['pid'])); $_POST['date']= date("Y-m-d H:i:s",time()); if($this->yuyue_order->add($_POST)){ $json = array( 'error'=> 1, 'msg'=> '添加成功!', 'url'=> $url ); echo json_encode($json); }else{ $json = array( 'error'=> 0, 'msg'=> '添加失败!', 'url'=> U($this->type.'/index',array('token'=>$this->$_POST['token'], 'wecha_id'=>$_POST['wecha_id'],$id=>$_POST['pid'])) ); echo json_encode($json); } } } //订单列表 public function order(){ $id = $this->_get('id'); $token = $this->_get('token'); $wecha_id = $this->_get('wecha_id'); $where = array( 'wecha_id'=> $wecha_id, 'pid'=> $id ); $data = $this->yuyue_order->where($where)->order('id desc')->select(); $info= $this->Yuyue_model->where(array('token'=> $this->_get('token'),'id'=>$id))->find(); //print_r($data);die; $this->assign('data',$data); $this->assign('info',$info); $this->display(); } //修改订单视图 public function set(){ $id = $this->_get('id'); $pid = $this->_get('pid'); $cast = array( 'token'=> $this->_get('token'), 'wecha_id'=> $this->_get('wecha_id') ); $data = M('yuyue_order')->where(array('id'=>$id))->find(); $info = M('yuyue_setcin')->where(array('name'=>$data['kind']))->find(); $info['sheng']=$info['yuanjia']-$info['youhui']; //print_r($data);print_r($info);die; $copyright=$this->Yuyue_model->where(array('token'=> $this->_get('token'),'id'=>$pid))->find(); $data['copyright']=$copyright['copyright']; //print_r($copyright);die; $data['token'] = $this->_get('token'); $data['wecha_id'] = $this->_get('wecha_id'); $wap= M('setinfo')->where(array('pid'=>$pid))->select(); $str=array(); foreach($wap as $v){ if($v['kind']==5){ $str["message"]=$v["name"]; } else{ $str[$v["name"]]=$v["value"]; } } //print_r($str);die; $arr= M('setinfo')->where(array('kind'=>'3','pid'=>$pid))->select(); $list= M('setinfo')->where(array('kind'=>'4','pid'=>$pid))->select(); $list_arr =array(); $i=0; foreach($list as $v){ $list[$i]['value']= explode("|",$v['value']); $i++; } //print_r($list);die; $text=$data['fieldsigle']; $down=$data['fielddownload']; $text=substr($text,1); $down=substr($down,1); $text=explode('$',$text); $down=explode('$',$down); $detail=array(); $i=1; foreach($text as $v){ $detail['text'][$i]=explode('#',$v); $i++; } $i=1; foreach($down as $v){ $detail['down'][$i]=explode('#',$v); } //print_r($detail);die; $this->assign('detail', $detail); $this->assign('str', $str); $this->assign('arr',$arr); $this->assign('list',$list); $this->assign('list_arr',$list); $this->assign('data', $data); $this->assign('info', $info); $this->display(); } //修改订单 public function runSet(){ $id = $_GET['id']; if(IS_POST){ $url = U($this->type.'/order',array('token'=>$_POST['token'], 'wecha_id'=>$_POST['wecha_id'],'id'=>$_POST['pid'],)); $url = substr($url,1); $where = array( 'id' =>$id ); if($this->yuyue_order->where($where)->save($_POST)){ $json = array( 'error'=> 1, 'msg'=> '修改成功!', 'url'=> $url ); echo json_encode($json); }else{ $json = array( 'error'=> 0, 'msg'=> '修改失败!', 'url'=> $url ); echo json_encode($json); } } } //删除订单 public function del(){ if(IS_POST){ $url = U($this->type.'/order',array('token'=>$_POST['token'], 'wecha_id'=>$_POST['wecha_id'],'id'=>$_POST['pid'],)); $url = substr($url,1); $where = array( 'id' =>$_POST['id'] ); if($this->yuyue_order->where($where)->delete()){ $json = array( 'error'=> 1, 'msg'=> '删除成功!', 'url'=> $url ); echo json_encode($json); }else{ $json = array( 'error'=> 0, 'msg'=> '删除失败!', 'url'=> $url ); echo json_encode($json); } } } //发邮件函数 public function send_email($Subject,$body,$emailuser,$emailpassword,$to_email){ date_default_timezone_set('PRC'); require_once 'class.phpmailer.php'; include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = 'smtp.163.com'; // SMTP server $mail->SMTPDebug = '1'; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPAuth = true; // enable SMTP authentication $mail->Port = 25; // set the SMTP port for the GMAIL server $mail->Username = "邮箱"; // SMTP account username $mail->Password = "邮箱密码"; // SMTP account password $mail->From = "邮箱"; // 发件人邮箱 $mail->FromName = "管理员"; // 发件人 //$mail->AddAddress($to_email, '商户'); $mail->AddReplyTo("邮箱",'微酒店'); $mail->Subject = $Subject; $mail->IsHTML(true); // send as HTML // optional, comment out and test $mail->MsgHTML($body); $to_email_arr=explode(",",$to_email); foreach($to_email_arr as $k => $v){ $mail->AddAddress($v, '商户'); } return($mail->Send()); } } ?>
读取文件夹中的所有图片文件
我第一次读取的时候没有问题。在删除图片后再读取图片会读取错误,以下是我的代码各位帮忙看一下。 后台代码 ``` using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; using System.Data; public partial class admin_netshopper_DHweihu_makepage_addhuandeng : System.Web.UI.UserControl { public string SlideFolderPath = myConfig.webimgshijiurl + "/kuaigou/huandeng/"; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!System.IO.Directory.Exists(SlideFolderPath)) { System.IO.Directory.CreateDirectory(SlideFolderPath); } bind(); } } public void bind() { string Images = ""; string[] Dir = System.IO.Directory.GetFiles(SlideFolderPath); foreach (string file in Dir) { System.IO.FileInfo FI = new System.IO.FileInfo(file); if (FI.Extension == ".jpg") { string name = FI.Name.Substring(0, FI.Name.Length - 4);// 获取文件名 string URL = myConfig.webimgurl + "/kuaigou/huandeng/" + FI.Name;// 组装图片路径 Images += URL + "," + name + ","; } } DataTable table = new DataTable();// 创建一个表 table.Columns.Add("URL");// 创建字段 table.Columns.Add("id"); string str = Images; if (str.Length > 0) { str = str.Substring(0, str.Length - 1); } string[] ss = str.Split(','); DataRow row = table.NewRow(); for (int i = 0; i < ss.Length; i++)// 为表插入数据 { if (i % 2 == 0) row = table.NewRow(); row[i % 2] = ss[i]; if ((i + 1) % 2 == 0) table.Rows.Add(row); } LblNumber.Text = table.Rows.Count.ToString(); if (table.Rows.Count > 0) { GV.DataSource = table; GV.DataBind(); divNumber.Style.Add("display", "block"); } else { GV.DataSource = null; GV.DataBind(); divNumber.Style.Add("display", "none"); } if (GV.Rows.Count == 1) { Button BtnDelete = (Button)GV.Rows[0].Cells[1].FindControl("BtnDelete"); BtnDelete.Enabled = false; } } protected void BtnDtal_Click(object sender, EventArgs e) { int Number = 0; string[] Dir = System.IO.Directory.GetFiles(SlideFolderPath); foreach (string file in Dir) { System.IO.FileInfo FI = new System.IO.FileInfo(file); if (FI.Extension == ".jpg")// 统计一共有多少个后缀为*.jpg的图片文件 { Number++; } } if (FUDtal.PostedFile.FileName == "") { Page.ClientScript.RegisterStartupScript(GetType(), "rsnn14", "<script>alert('请选择图片');</script>"); return; } if (Number == 0) { Number = 1; } else if (Number > 0) { Number = Number + 1; } string name = FUDtal.PostedFile.FileName;//获取文件名称 int index = name.LastIndexOf("."); string lastName = name.Substring(index, name.Length - index);//文件后缀 string Newname = Number.ToString() + lastName;//文件名 // || lastName == ".bmp" || lastName == ".gif" || lastName == ".png" if (lastName == ".jpg") { System.Drawing.Image image = System.Drawing.Image.FromStream(FUDtal.PostedFile.InputStream); int height = image.Height; int width = image.Width; if (height == 481 && width == 1920) { string path = SlideFolderPath + Newname; FUDtal.PostedFile.SaveAs(path);//保存到服务器上 Page.ClientScript.RegisterStartupScript(GetType(), "rsnn2", "<script>alert('图片上传成功');</script>"); bind(); } else { Page.ClientScript.RegisterStartupScript(GetType(), "rsnn12", "<script>alert('图片尺寸错误');</script>"); return; } } else { Page.ClientScript.RegisterStartupScript(GetType(), "rsnn17", "<script>alert('图片后缀错误!');</script>"); return; } } protected void BtnDelete_Click(object sender, EventArgs e) { int row = ((GridViewRow)((Button)sender).NamingContainer).RowIndex; HiddenField HFid = (HiddenField)GV.Rows[row].Cells[0].FindControl("HFid"); string Route = SlideFolderPath + HFid.Value + ".jpg"; FileInfo file = new FileInfo(Route);//指定文件路径 if (file.Exists)//判断文件是否存在 { file.Attributes = FileAttributes.Normal;//将文件属性设置为普通,比方说只读文件设置为普通 file.Delete();//删除文件 if (file.Exists == false) { Page.ClientScript.RegisterStartupScript(GetType(), "rsnn3", "<script>alert('图片删除成功');</script>"); bindReset(); bind(); } else { Page.ClientScript.RegisterStartupScript(GetType(), "rsnn16", "<script>alert('图片删除失败');</script>"); return; } } } public void bindReset()// 重新命名图片 { string Images = ""; string[] Dir = System.IO.Directory.GetFiles(SlideFolderPath); foreach (string file in Dir) { System.IO.FileInfo FI = new System.IO.FileInfo(file); if (FI.Extension == ".jpg") { string name = FI.Name.Substring(0, FI.Name.Length - 4);// 获取文件名 Images += name + ","; } } DataTable table = new DataTable();// 创建一个表 table.Columns.Add("id");// 创建字段 string str = Images; if (str.Length > 0) { str = str.Substring(0, str.Length - 1); } string[] ss = str.Split(','); DataRow row = table.NewRow(); for (int i = 0; i < ss.Length; i++)// 为表插入数据 { if (i % 1 == 0) row = table.NewRow(); row[i % 1] = ss[i]; if ((i + 1) % 1 == 0) table.Rows.Add(row); } for (int i = 0; i < table.Rows.Count; i++) { string id = table.Rows[i]["id"].ToString(); string srcFileName = SlideFolderPath + id + ".jpg"; string destFileName = SlideFolderPath + (i + 1) + ".jpg"; if (System.IO.File.Exists(srcFileName)) { System.IO.File.Move(srcFileName, destFileName);// 重新命名图片 } } } } ``` 前台代码 ``` <%@ Control Language="C#" AutoEventWireup="true" CodeFile="addhuandeng.ascx.cs" Inherits="admin_netshopper_DHweihu_makepage_addhuandeng" %> <div style="width: 1024px; -moz-box-shadow: 0px 0px 10px #BFBFBF; -webkit-box-shadow: 0px 0px 10px #BFBFBF; box-shadow: 0px 0px 10px #BFBFBF; padding: 20px 5px; margin: 50px auto"> <div style="width: 98%; margin-left: auto; margin-right: auto;"> <asp:FileUpload ID="FUDtal" runat="server" /> <asp:Button ID="BtnDtal" runat="server" Text="上传" Height="30px" OnClick="BtnDtal_Click" /> 后缀: *.jpg(注:图片格式为宽:1920px、高:481px) </div> <div style="width: 98%; margin: 20px auto 0px auto;"> <div id="divNumber" runat="server" style="width: 100%; text-align: left; display: block; margin-bottom: 5px;"> 当前共有<asp:Label ID="LblNumber" runat="server"></asp:Label>张图片 </div> <asp:GridView ID="GV" runat="server" Width="100%" CellPadding="4" ForeColor="#333333" GridLines="None" AutoGenerateColumns="False"> <Columns> <asp:TemplateField HeaderText="图片"> <ItemTemplate> <asp:Image ID="Images" runat="server" Width="900px" ImageUrl='<%# Eval("URL") %>' /> <asp:HiddenField ID="HFid" runat="server" Value='<%# Eval("id") %>' /> </ItemTemplate> <HeaderStyle HorizontalAlign="Center" /> <ItemStyle HorizontalAlign="Center" /> </asp:TemplateField> <asp:TemplateField HeaderText="操作"> <ItemTemplate> <asp:Button ID="BtnDelete" runat="server" Text="删除" Width="40px" Height="30px" OnClick="BtnDelete_Click" /> </ItemTemplate> <HeaderStyle HorizontalAlign="Center" /> <ItemStyle HorizontalAlign="Center" /> </asp:TemplateField> </Columns> <AlternatingRowStyle BackColor="White" /> <EditRowStyle BackColor="#2461BF" /> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <RowStyle BackColor="#EFF3FB" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <SortedAscendingCellStyle BackColor="#F5F7FB" /> <SortedAscendingHeaderStyle BackColor="#6D95E1" /> <SortedDescendingCellStyle BackColor="#E9EBEF" /> <SortedDescendingHeaderStyle BackColor="#4870BE" /> </asp:GridView> </div> </div> ```
优惠券算法问题,求算法帝,来一发!!
问题是这样的:有n个m元的优惠券,要结账y元,求如何最省?? 例如 10元2个, 5元3个 ,3元7个;我分别结账50;28;15元; 发现当数额越小时,算最优解的偏差越多,求算法帝解决一下 //C# using System; using System.Collections.Generic; using System.Linq; namespace Calculation { public class Greedy { public string msg = ""; public string Fun(string str) { string res = ""; var money = Exchange(Convert.ToDecimal(str)); decimal sum = 0; foreach (var single in money) { if (single.Value != 0) { sum += single.Key*single.Value; string s = string.Format("{0}元---->{1}张; 共{2}元 \r\n", single.Key, single.Value, sum); res += s; } } return res + "\r\n" + sum + "-" + str + "=" + (sum - Convert.ToDecimal(str)) + "\r\n" + msg; } public Dictionary<decimal, int> Money = new Dictionary<decimal, int>(); public Dictionary<decimal, int> SetInit(decimal a,int c) { //key表示钱,value表示钱的张数 Money.Add(a, c); return Money; } private Dictionary<decimal, int> Exchange(decimal num) { //指针 int i = 0; int count = 1; Dictionary<decimal, int> ResMoney = Money.OrderByDescending(o => o.Key).ToDictionary(o => o.Key, p => p.Value); while (true) { #region 获取当前面值,若指针超出则直接跳出 decimal tar; decimal next; if (i > ResMoney.Count) { //超出 msg = "i > ResMoney.Count"; break; } else { tar = ResMoney.Keys.ElementAt(i); //取得面值 } if (i > ResMoney.Count - 2) { next = 0; } else { next = ResMoney.Keys.ElementAt(i + 1); //取得面值 } #endregion if (num > tar) { num = num - tar; //当前面额是否用完 if (count < ResMoney[tar]) { count++; //money的张数自增 } else { i++; //就去取下一张面值 if (i == ResMoney.Count) { msg = "num > tar"; break; } ResMoney[tar] = count; count = 1; } } else if (num == tar) { //当余额等于当前面额时,count跳出 -4 -2 -9 -5 ResMoney[tar] = count; msg = "num == tar"; break; } else if (next < num && num < tar && next != 0) { i++; //就去取下一张面额 if (i == ResMoney.Count) { msg = "next < num && num < tar && next != 0"; break; } ResMoney[tar] = 0; } else if (num == next && next != 0) { if (tar == next) { //余额等于最小面额,count跳出 ResMoney[tar] = count; msg = "num == next && next != 0;tar == next"; break; } else { i++; //就去取下一张面额 if (i == ResMoney.Count) { msg = "num == next && next != 0"; break; } ResMoney[tar] = 0; } } else if (num < next && next != 0) { //余额小于最小面额,跳出 -2 -1 ResMoney[tar] = count; msg = "num < next && next != 0"; break; } else if (next==0) { //余额小于最小面额,跳出 -2 -7 ResMoney[tar] = count; msg = "next==0"; break; } } if (i < ResMoney.Count) { i++; for (;i<ResMoney.Count;i++) { decimal max = ResMoney.Keys.ElementAt(i); //取得面值 ResMoney[max] = 0; } return ResMoney; } else { return ResMoney; } } } }
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
此博客仅为我业余记录文章所用,发布到此,仅供网友阅读参考,如有侵权,请通知我,我会删掉。 补充 有不少读者留言说本文章没有用,因为天气预报直接打开手机就可以收到了,为何要多此一举发送到邮箱呢!!!那我在这里只能说:因为你没用,所以你没用!!! 这里主要介绍的是思路,不是天气预报!不是天气预报!!不是天气预报!!!天气预报只是用于举例。请各位不要再刚了!!! 下面是我会用到的两个场景: 每日下
死磕YOLO系列,YOLOv1 的大脑、躯干和手脚
YOLO 是我非常喜欢的目标检测算法,堪称工业级的目标检测,能够达到实时的要求,它帮我解决了许多实际问题。 这就是 YOLO 的目标检测效果。它定位了图像中物体的位置,当然,也能预测物体的类别。 之前我有写博文介绍过它,但是每次重新读它的论文,我都有新的收获,为此我准备写一个系列的文章来详尽分析它。这是第一篇,从它的起始 YOLOv1 讲起。 YOLOv1 的论文地址:https://www.c
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的 回答 - Bravo Yeung,获得该问题下回答中得最高赞(236赞和1枚专业勋章),对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalk
20行Python代码爬取王者荣耀全英雄皮肤
引言 王者荣耀大家都玩过吧,没玩过的也应该听说过,作为时下最火的手机MOBA游戏,咳咳,好像跑题了。我们今天的重点是爬取王者荣耀所有英雄的所有皮肤,而且仅仅使用20行Python代码即可完成。 准备工作 爬取皮肤本身并不难,难点在于分析,我们首先得得到皮肤图片的url地址,话不多说,我们马上来到王者荣耀的官网: 我们点击英雄资料,然后随意地选择一位英雄,接着F12打开调试台,找到英雄原皮肤的图片
简明易理解的@SpringBootApplication注解源码解析(包含面试提问)
欢迎关注文章系列 ,关注我 《提升能力,涨薪可待》 《面试知识,工作可待》 《实战演练,拒绝996》 欢迎关注我博客,原创技术文章第一时间推出 也欢迎关注公 众 号【Ccww笔记】,同时推出 如果此文对你有帮助、喜欢的话,那就点个赞呗,点个关注呗! 《提升能力,涨薪可待篇》- @SpringBootApplication注解源码解析 一、@SpringBootApplication 的作用是什
西游记团队中如果需要裁掉一个人,会先裁掉谁?
2019年互联网寒冬,大批企业开始裁员,下图是网上流传的一张截图: 裁员不可避免,那如何才能做到不管大环境如何变化,自身不受影响呢? 我们先来看一个有意思的故事,如果西游记取经团队需要裁员一名,会裁掉谁呢,为什么? 西游记团队组成: 1.唐僧 作为团队teamleader,有很坚韧的品性和极高的原则性,不达目的不罢休,遇到任何问题,都没有退缩过,又很得上司支持和赏识(直接得到唐太宗的任命,既给
Python语言高频重点汇总
Python语言高频重点汇总 GitHub面试宝典仓库——点这里跳转 文章目录Python语言高频重点汇总**GitHub面试宝典仓库——点这里跳转**1. 函数-传参2. 元类3. @staticmethod和@classmethod两个装饰器4. 类属性和实例属性5. Python的自省6. 列表、集合、字典推导式7. Python中单下划线和双下划线8. 格式化字符串中的%和format9.
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外
ES6基础-ES6的扩展
进行对字符串扩展,正则扩展,数值扩展,函数扩展,对象扩展,数组扩展。 开发环境准备: 编辑器(VS Code, Atom,Sublime)或者IDE(Webstorm) 浏览器最新的Chrome 字符串的扩展: 模板字符串,部分新的方法,新的unicode表示和遍历方法: 部分新的字符串方法 padStart,padEnd,repeat,startsWith,endsWith,includes 字
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
你知道的越多,你不知道的越多 点赞再看,养成习惯 本文 GitHub https://github.com/JavaFamily 已收录,有一线大厂面试点思维导图,也整理了很多我的文档,欢迎Star和完善,大家面试可以参照考点复习,希望我们一起有点东西。 前前言 为啥今天有个前前言呢? 因为你们的丙丙啊,昨天有牌面了哟,直接被微信官方推荐,知乎推荐,也就仅仅是还行吧(心里乐开花)
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca
Python爬虫精简步骤1 获取数据
爬虫的工作分为四步: 1.获取数据。爬虫程序会根据我们提供的网址,向服务器发起请求,然后返回数据。 2.解析数据。爬虫程序会把服务器返回的数据解析成我们能读懂的格式。 3.提取数据。爬虫程序再从中提取出我们需要的数据。 4.储存数据。爬虫程序把这些有用的数据保存起来,便于你日后的使用和分析。 这一篇的内容就是:获取数据。 首先,我们将会利用一个强大的库——requests来获取数据。 在电脑上安装
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东
破14亿,Python分析我国存在哪些人口危机!
2020年1月17日,国家统计局发布了2019年国民经济报告,报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏,但是很多人并没有看到我国复杂的人口问题:老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧! 更多有趣分析教程,扫描下方二维码关注vx公号「裸睡的猪」 即可查看! 一、背景 1.人口突破14亿 2020年1月17日,国家统计局发布
web前端javascript+jquery知识点总结
Javascript javascript 在前端网页中占有非常重要的地位,可以用于验证表单,制作特效等功能,它是一种描述语言,也是一种基于对象(Object)和事件驱动并具有安全性的脚本语言 ,语法同java类似,是一种解释性语言,边执行边解释。 JavaScript的组成: ECMAScipt 用于描述: 语法,变量和数据类型,运算符,逻辑控制语句,关键字保留字,对象。 浏览器对象模型(Br
Qt实践录:开篇
本系列文章介绍笔者的Qt实践之路。 背景 笔者首次接触 Qt 大约是十多年前,当时试用了 Qt ,觉得不如 MFC 好用。现在 Qt 的 API、文档等都比较完善,在年初决定重新拾起,正所谓技多不压身,将 Qt 当为一种谋生工具亦未尝不可。利用春节假期的集中时间,快速专攻一下。 本系列名为“Qt实践”,故不是教程,笔者对 Qt 的定位是“使用”,可以帮助快速编写日常的工具,如串口、网络等。所以不
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ......
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。   再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。   下文是原回答,希望能对你能有所启发。   如果我说,这个世界上人真的分三六九等,
为什么听过很多道理,依然过不好这一生?
记录学习笔记是一个重要的习惯,不希望学习过的东西成为过眼云烟。做总结的同时也是一次复盘思考的过程。 本文是根据阅读得到 App上《万维钢·精英日课》部分文章后所做的一点笔记和思考。学习是一个系统的过程,思维模型的建立需要相对完整的学习和思考过程。以下观点是在碎片化阅读后总结的一点心得总结。
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计
一条链接即可让黑客跟踪你的位置! | Seeker工具使用
搬运自:冰崖的部落阁(icecliffsnet) 严正声明:本文仅限于技术讨论,严禁用于其他用途。 请遵守相对应法律规则,禁止用作违法途径,出事后果自负! 上次写的防社工文章里边提到的gps定位信息(如何防止自己被社工或人肉) 除了主动收集他人位置信息以外,我们还可以进行被动收集 (没有技术含量) Seeker作为一款高精度地理位置跟踪工具,同时也是社交工程学(社会工程学)爱好者...
作为程序员的我,大学四年一直自学,全靠这些实用工具和学习网站!
我本人因为高中沉迷于爱情,导致学业荒废,后来高考,毫无疑问进入了一所普普通通的大学,实在惭愧...... 我又是那么好强,现在学历不行,没办法改变的事情了,所以,进入大学开始,我就下定决心,一定要让自己掌握更多的技能,尤其选择了计算机这个行业,一定要多学习技术。 在进入大学学习不久后,我就认清了一个现实:我这个大学的整体教学质量和学习风气,真的一言难尽,懂的人自然知道怎么回事? 怎么办?我该如何更好的提升
前端JS初级面试题二 (。•ˇ‸ˇ•。)老铁们!快来瞧瞧自己都会了么
1. 传统事件绑定和符合W3C标准的事件绑定有什么区别? 传统事件绑定 &lt;div onclick=""&gt;123&lt;/div&gt; div1.onclick = function(){}; &lt;button onmouseover=""&gt;&lt;/button&gt; 注意: 如果给同一个元素绑定了两次或多次相同类型的事件,那么后面的绑定会覆盖前面的绑定 (不支持DOM事...
相关热词 c#导入fbx c#中屏蔽键盘某个键 c#正态概率密度 c#和数据库登陆界面设计 c# 高斯消去法 c# codedom c#读取cad文件文本 c# 控制全局鼠标移动 c# temp 目录 bytes初始化 c#
立即提问