预览模式: 普通 | 列表

Asp几秒钟后再执行后面的代码

Dim iSeconds : iSeconds = 0.3
Dim t:t=Timer()
While(Timer()<t+iSeconds)
'Do Nothing
Wend

Tags: asp

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 1905

<%
Dim str : str = "UserName"
Execute("dim " & str & " : " & str & "=""subendong""")
Response.Write(UserName)


execute("dim arr_bigClass(10,1)")'数组是从0开始的
Response.Write( ubound(arr_bigClass, 2) )
%>

 

说明:没什么特别,您只要将Execute里面的参数理解成文件里的内容就可以了。

查看更多...

Tags: asp

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 2448

Asp过滤数组中的重复数据

'过滤数组中的重复数据
 Function FilterRepeatDataFromArray(cxstr1,cxstr2)
  IF isarray(cxstr1) Then
   cxarraynull = "对不起,参数1不能为数组。"
   Exit Function
  End IF
  IF cxstr1 = "" or isempty(cxstr1) Then
   cxarraynull = "nodate"
   Exit Function
  End IF
  ss = split(cxstr1,cxstr2)
  cxs=cxstr2&ss(0)&cxstr2
  sss=cxs
  For m = 0 To ubound(ss)
   cc = cxstr2&ss(m)&cxstr2
   IF instr(sss,cc)=0 Then
    sss = sss&ss(m)&cxstr2
   End IF
  Next
  FilterRepeatDataFromArray = right(sss,len(sss)-len(cxstr2))
  FilterRepeatDataFromArray = left(FilterRepeatDataFromArray,len(FilterRepeatDataFromArray)-len(cxstr2))
 End Function

Tags: asp

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 1981

asp获取GMT时间

<%
Function DateTimeToGMT(sDate)
   Dim dWeek,dMonth
   Dim strZero,strZone
   strZero="00"
   strZone="GMT"
   dWeek=Array("Sun","Mon","Tue","Wes","Thu","Fri","Sat")
   dMonth=Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
   DateTimeToGMT = dWeek(WeekDay(sDate)-1)&", "&Right(strZero&Day(sDate),2)&" "&dMonth(Month(sDate)-1)&" "&Year(sDate)&" "&Right(strZero&Hour(sDate),2)&":"&Right(strZero&Minute(sDate),2)&":"&Right(strZero&Second(sDate),2)&" "&strZone
End Function

Response.Write( DateTimeToGMT( Now() ) )
%>

Tags: asp

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 2090

ASP获取文件的最后修改时间

  '获取文件的最后修改时间

    Function GetFileLastModifiedTime(FileName)

   Dim FSO, File, FilePath, FileTime

   IF FileName = "" Then

查看更多...

Tags: asp

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 1925

php类继承实例

PHP代码
  1. <?php   
  2. class Person   
  3. {   
  4. public $name$age$sex;   
  5. public function __construct($name$age$sex)   
  6. {   
  7.    $this->name = $name;   
  8.    $this->age = $age;   
  9.    $this->sex = $sex;   
  10. }   
  11. }   
  12.   
  13. class Child extends Person   
  14. {   
  15. public function say($word)   
  16. {   
  17.    echo($word);   
  18. }   
  19. }   
  20.   
  21. $Child = new Child("田志刚", 30, "男");   
  22. $Child->say("hello");   
  23. echo($Child->name);   
  24. //输出结果:hello田志刚   
  25. ?>   

Tags: php

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 1719

PHP htmlentities和html_entity_decode

<?php
$a = "<div style=\"width:100px; height:20px; border:1px solid #ff0000;\">abc</div>";
$a = htmlentities($a);
$a = html_entity_decode($a);
echo($a);
//echo html_entity_decode(htmlentities($arr[1][1]));
?>

 

如果将带HTML的数据放入XML文件中,这个就起很大作用了。

Tags: php

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 1994

php javascript cookie中文乱码解决办法

至于此类情况可以在服务端对中文进行处理。

php类似于javascript encodeURI和decodeURI解码的方法(转)
<script language="javascript">
var a = encodeURI("电影");     
alert(a);
var b = decodeURI(a);
alert(b)
</script>

<?php
$a = urlencode(iconv("gb2312", "UTF-8", "电影")); //等同于javascript encodeURI("电影");
echo $a;
$b = iconv("utf-8","gb2312",urldecode("%E7%94%B5%E5%BD%B1")); //等同于javascript decodeURI("%E7%94%B5%E5%BD%B1");
echo $b;
?>

如果编码是UTF-8的话就可以直接用urlencode 或 urldecode 转换!

如果不行可以转换两次就可以了,即在JS里面用2次decodeURI。

Tags: php

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 1757

php、asp以“流格式”下载服务器端文件

解决WORD,EXCEL,TXT,图片等文件类型直接在IE中被打开的问题

ASP/Visual Basic代码
  1. <%   
  2.     Function downFileFromServer(showFileName, downFilePath)   
  3.         response.Clear   
  4.         response.Buffer = true   
  5.         Set ads = Server.CreateObject("ADODB.Stream")   
  6.         ads.Type = 1   
  7.         ads.Mode = 3   
  8.         ads.Open   
  9.         ads.LoadFromFile downFilePath   
  10.         response.AddHeader("Content-Encoding""None")   
  11.         response.AddHeader("Cache-Control""Private")   
  12.         response.AddHeader("Content-Length", ads.Size)   
  13.         response.AddHeader("Content-Disposition""attachment; filename=" & showFileName)   
  14.         response.ContentType = "application/octet-stream"  
  15.         response.BinaryWrite(ads.Read(ads.Size))   
  16.         ads.Close   
  17.         Set ads = nothing   
  18.         response.Flush   
  19.         response.End  
  20.     End Function  
  21.   
  22.     Call downFileFromServer("abc.test", Server.MapPath("test.asp"))   
  23. %>   
  24.   

 

PHP代码
  1. <?php   
  2.     function downFileFromServer($showFileName$downFilePath)   
  3.     {   
  4.         if(file_exists($downFilePath))   
  5.         {   
  6.             if(is_readable($downFilePath))   
  7.             {   
  8.                 if(Trim($showFileName) == '')   
  9.                 {   
  10.                 $showFileName = 'undefined';   
  11.                 }   
  12.                 ob_start();   
  13.                 ob_clean();   
  14.                 $file_size = filesize($downFilePath);   
  15.                 header('Content-Encoding:none');   
  16.                 header('Cache-Control:private');   
  17.                 header('Content-Length:' . $file_size);   
  18.                 header('Content-Disposition:attachment; filename=' . $showFileName);   
  19.                 header('Content-Type:application/octet-stream');   
  20.                 readfile($downFilePath);   
  21.                 ob_flush();   
  22.             }   
  23.         }   
  24.     }   
  25.   
  26.     //Sample    
  27.     downFileFromServer('a.abc''test.php');   
  28. ?>   

查看更多...

Tags: asp php

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 1666

php遍历文件夹和文件

<?php
$path = 'UploadFile';
function getfiles($path)
{
   if(!is_dir($path))
   {
    return;
   }
   $handle = opendir($path);
   while( false !== ( $f = readdir( $handle ) ) )
   {
    if($f != '.' && $f != '..')
    {
     $path2 = $path . '/' . $f;
     if( is_dir( $path2 ) )
     {
      echo "<br />" . $f;
      getfiles( $path2 );
     }
     else
     {
      echo "<br />" . $f;
     }
    }
   }
}

print_r( getfiles($path) );
?>

Tags: php

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 1628

PHP中的escape函数以及Jsonp实例

function phpescape($str){
    preg_match_all("/[\x80-\xff].|[\x01-\x7f]+/",$str,$newstr);
    $ar = $newstr[0];
    foreach($ar as $k=>$v){
        if(ord($ar[$k])>=127){
            $tmpString=bin2hex(iconv("GBK","ucs-2",$v));
            if (!eregi("WIN",PHP_OS)){
                $tmpString = substr($tmpString,2,2).substr($tmpString,0,2);
            }
            $reString.="%u".$tmpString;
        } else {
            $reString.= rawurlencode($v);
        }
    }
    return $reString;
}

 

实例:
$xml = file_get_contents("index.xml");
$xml = phpescape($xml);
$jsondata = "{symbol:\"" . $xml . "\"}";
echo $_GET['callback'].'('.$jsondata.')';


 

Tags: php

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 1715

PHP伪原创之随机段落

<?php
 //原始字符串
 $p = "<p>p0</p><p>p1</p><p>p2</p><p>p3</p>";
 //处理完之后的字符串
 $p = DoP($p);
 //输出处理的结果
 echo($p);
 
 
 /*处理P标记**/
 function DoP($content)
 {
  //正则提取P标记
  $arr = GetField($content);
  //将每个P标记都加上ID
  $arrLen = count($arr);
  for ( $i = 0; $i < $arrLen; $i ++ )
  {
   $arr[$i] = str_replace("<p", "<p id=\"p" . $i . "\"", $arr[$i]);
  }
  //对数组重新排序
  shuffle($arr, SORT_NUMERIC);
  //将数组组成字符串
  $content = implode("", $arr);
  return ($content);
 }
 /*正则表达式提取**/
 function GetField($content)
 {
  $patrn = "/<p[\s\S]*?>[\s\S]*?<\/p>/i";
  preg_match_all($patrn, $content, $matches);
  return($matches[0]);
 }
?>

Tags: php

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 2745

 广告位

↑返回顶部↑