1,在函数中,传递数组时 使用 return 比使用 global 要高效,比如 以下是PHP代码:【复制】 function userloginfo($usertemp){ $detail=explode("|",$usertemp); return $detail; } $login=userloginfo($userdb); 比 function userloginfo($usertemp){ global $detail; $detail=explode("|",$usertemp); } userloginfo($userdb); 要高效 2,(这个代码用于得到程序目录对应的网址,推荐使用) $urlarray=explode('/',$HTTP_SERVER_VARS['REQUEST_URI']); $urlcount=count($urlarray);unset($urlarray[$urlcount-1]); $ofstarurl='http://'.$HTTP_SERVER_VARS['HTTP_HOST'].impl...
$uptypes=array('image/jpg','image/jpeg','image/pjpeg','image/gif');//上传图片文件类型列表$wFile="a.jpg";//取得文件路径$waterimg="hq.gif";//水印图片路径if(in_array($wFile['type'], $uptypes)){//检查文件类型,若上传的文件为jpg或gif图片则加水印if(strstr($wFile['type'],"jp")){ //若上传图片类型为jpg,pjpeg,jpeg,则用imagecreatefromjpeg读取目标文件$im = imageCreatefromjpeg($wFile);$wfilew=imagesx($im);//取得图片的宽$wfileh=imagesy($im);//取得图片的高}else{//否则若上传图片类型为gif,则用imagecreatefromgif读取目标文件$im = imageCreatefromgif($wFile);$wfilew=imagesx($...
需求:将一段文字截取一定的物理长度显示,注意,要截取的不是字符串的字节数,UFT-8 的编码中文字符是3个字节或者4个字节的,而显示的时候中文会占两个字符的长度,英文字符只占一个,全角的时候又有不同。而且给的数据是HTML代码串,比如这样:<div class=”aaa”><a href=”/aaa.php?id=1″>张三</a> 评论了 <a href=”/aaa.php?id=444″>李四</a> 分享的 <a href=”bbb.html”>一篇文章文章一长串的东西</a></div>截取的时候是要截取 div 标签内部的东西,而且要保留HTML标签,只是对其中的文字做处理。比如我可能只是截取到“李...
<?php exec("/bin/grep -r '$oldword' $rootpath", $results, $errorCode); if ($errorCode){ if ($errorCode == 1){ echo "Possibly no files were found with $oldword in them<BR>\n"; } echo "OS Error: $errorCode<BR>\n"; echo "Check 'man errno' and count down<BR>\n"; echo "Usually paths/permissions<BR>\n"; } while (list(,$path) = each($results)){ $parts = explode(':', $path); $path = $parts[0]; $fp = fopen($path, 'r') or print("Cannot read $path<BR>\n"); if ($fp){ $data = fread($fp, filesiz...
NO.1--建立一个XML数据库data.xml <?xml version="1.0"?> <records> <record> <name>caca</name> <qq>154222225</qq> <email>
[email protected]</email> </record> <records> NO.2--建立对象CreateObject 建立data.xml的对象先 set xmldoc=server.createobjcet("microsoft.xmldom") xmldoc.load(server.mappath("data.xml") NO.3--选定节点SelectNode 你想操作哪个Node,必须定位到这个节点是不是,先看看这个data.xml有几个Node?? 用一个递归函数搞定: getnodes(xmldoc) sub getnodes(node) dim i response.write("<br>&...
如今的采集系统是一个比一个NB,站长们辛苦收集制作的网站内容总是很快出现在在另一个网站上,一个网站轻易的就被复制了又复制。有办法既不影响搜索引擎的正常收入又能解决网站被采集之苦么?答案是肯定的。最常用的防采集方法:1.每个文章的命名不要有任何规律,比如你的文章是<%=id%>.htm的话,请在前面或后面生成个日期,如:20070911-1234.htm,前面的就是日期了,这样对采集新手来说是非常有效的。2.不要把所有的文章都放在一个目录下,你可以利用日期生成不同的目录名。3.不要所有的文章都用一个模板,制作尽量多的模板,添文章的时候可有选要用哪个模板,一般采集者的采集程序是有针对性的,他在采集前会对你的页面进行分析,如果你...
作用:将页面中的电话号码生成图片格式。 <% Call Com_CreatValidCode(Request.QueryString("tel")) Public Sub Com_CreatValidCode(pTel) '----------禁止缓存 Response.Expires = 0 Response.AddHeader "Pragma","no-cache" Response.AddHeader "cache-ctrol","no-cache" Response.ContentType = "Image/BMP" Randomize Dim i, ii, iii ,rndColor,strLen,sql,rs Const cOdds = 5 '------------杂点出现的机率 Const str="0123456789-" strLen = len(pTel) rndColor = ChrB(cint(rnd*255)) & ChrB(cint(rnd*255)) ...
Dim url, body, myCacheurl = Request.QueryString("url")Set myCache = new cachemyCache.name = "picindex"&urlIf myCache.valid Thenbody = myCache.valueElsebody = GetWebData(url)myCache.add body,dateadd("d",1,now)End IfIf Err.Number = 0 ThenResponse.CharSet = "gb2312"Response.ContentType = "application/octet-stream"Response.BinaryWrite bodyResponse.FlushElseWscript.Echo Err.DescriptionEnd if'取得数据Public Function GetWebData(ByVal strUrl)Dim curlpathcurlpath = Mid(strUrl,1,Instr(8,strUrl,&quo...
本例主要讲述如何应用Create、Drop和Alter语句增加、删除ACCESS表和字段,代码如下: 以下是ASP代码:【复制】 ''''''''''''''''''''''''''''''''''''' 增加、删除表和字段' ├Create Table 表名(field1 type[(size)] [null|not null] [default eExpression] [primary key][,field2...])' type:counter;text(num);char(num),varchart(num);memo;short;long;single;double;date/time;logical;currency;oleobject' ├Drop Table 表名' ├Alter Table 表名 Add Column field type[(size)][not null]' ├Alter Table 表名 Drop Column field''''''''''''''''''''''''''''''''''''Dim objConn,strsqlSet objConn = Serv...
Call robot()Sub robot()Dim robots:robots="Baiduspider@Baidu|Baiduspider+@Baidu|Google@Google|Googlebot@Google|
[email protected]|ia_archiver@Alexa|IAArchiver@Alexa|ASPSeek@ASPSeek|YahooSeeker@Yahoo|sohu-search@Sohu|help.yahoo.com/help/us/ysearch/slurp@Yahoo|sohu-search@SOHU|MSNBOT@MSN"dim I1,I2,l1,l2,l3,i,rsl2=falsel1=request.servervariables("http_user_agent")F1=request.ServerVariables("SCRIPT_NAME")I1=split(robots,chr(124))for i=0 to ubound(I1)I2=split(I1(i),"@")if instr(lcase(l1),lcase(I2(0))...
该段代码涉及到JMail v4.3的大部分常用方法。包括邮件基本信息、身份验证、附件等。无需很多的修改就可以使用,也可以改成函数或过程。<%Dim JMail, contentIdSet JMail = Server.CreateObject("JMail.Message")JMail.Charset = "gb2312" ' 邮件字符集,默认为"US-ASCII"' JMail.ISOEncodeHeaders = False ' 是否进行ISO编码,默认为True' 发送者信息(可用变量方式赋值)JMail.From = "
[email protected]" ' 发送者地址JMail.FromName = "D.J." ' 发送者姓名JMail.Subject = "您在炫网资讯的歌词快递(请将编码设为简体中文(gb2312))...
用到prototype的Ajax.Updater()方法来动态更新页面上一个div 的块,发现了一个问题。比如我需要在当前页面Index.aspx中id为content的div中替换其内容为另外一个页面Content.aspx的内容,那么我可以使用方法new Ajax.Updater("content", "Content.aspx")来实现。这里就出现问题了,假设Content.aspx页面的内容如下:Content.aspx<html>.....<script type="text/javascript">function myFunc(){......}</script><body><div onclick="myFunc()">click me</div></body>........... Index.aspx的代码如下:Index.aspx<html>...<script type=...
样式代码: 复制代码 代码如下:#div_maskContainer { display: none; } /*蒙版样式*/ #div_Mask{ z-index:1000; filter:alpha(opacity=40); position: absolute; left:0px; top:0px; background-color: #D4D0C8; } /*显示信息样式*/ #div_loading{ width:300px;height: 60px;position: absolute; border: 1px outset #B4E0F2; padding-top: 40px; text-align: center; background-color: #CCE9F9; z-index: 10000; filter:alpha(opacity=100);!important } js控件代码: 复制代码 代码如下:/** 蒙版信息控件 用法: 1.引用 mask.css 2.引用 mask.js 3.调用方法 var obj=new MaskControl(); //显示蒙版提示信息 obj.show("显示...
以下是Javascript代码:【运行代码】【复制代码】 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>JS弹出层 --CSS教程 www.goalercn.com</title><style>body {margin:0px}#Loading {position:absolute;z-index:10;left:10px;top:10px;border:1px #666666 solid;background:#eeeeee;width:10px;height:10px}</style><script LANGUAGE="JavaScript"> <!-- ...