博文

[置顶] php判断一个字符串是否包含另一个字符串(2010-01-19 13:07:00)

摘要:<?$str="1,2,3,4,5";$s="1";if (count(explode($s,$str))>1) echo "存在"; else echo "不存在";?>......

阅读全文(2337) | 评论:1

php操作access数据库代码(2010-01-04 14:34:00)

摘要:<%$dbc=new com("adodb.connection");$a=dirname(__FILE__);$path=$a."\mydata.mdb";$dbc->open("provider=Microsoft.Jet.OLEDB.4.0;Data Source=".$path);$rs=$dbc->execute("select * from dbl_admin");     $i=0;     while (!$rs->eof){      $i+=1;  $fld0=$rs["dbl_user_name"]; $fld1=$rs["dbl_user_password"];  print_r($fld0->value."======".$fld1->value."<br>");  $rs->movenext();     }     $rs->close();%>......

阅读全文(1271) | 评论:0

火狐下强制换行(2009-11-24 17:41:00)

摘要:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh" lang="zh"><head profile="http://www.w3.org/2000/08/w3c-synd/#"><meta http-equiv="content-language" content="zh-cn" /><meta http-equiv="content-type" content="text/html;charset=gb2312" /><title>blueidea</title><style type="text/css">/*<![CDATA[*/div { width:300px; word-wrap:break-word; border:1px solid red; }/*]]>*/</style></head><body><div id="ff">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div><script type="text/javascript">// <![CDATA[function toBreakWord(intLen){var obj=document.getElementById("ff");var strContent=obj.innerHTML;&n......

阅读全文(1726) | 评论:0

php获取本页URL地址(2009-11-23 11:44:00)

摘要:<?echo "http://".$_SERVER['SERVER_NAME'].$_SERVER["REQUEST_URI"];?>......

阅读全文(2966) | 评论:0

区别PHP4和PHP5版本的代码(2009-10-10 06:51:00)

摘要:<?$array1=array(1,2,3,4);$array2=null;$array3='non-array';$array4=array('a','b','c');print_r(array_merge($array1,$array2,$array3,$array4));?> PHP4输出的是Array{    [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 'non-array' [5] => a [6] => b [7] => c} PHP5输出的是  Warning: array_merge() [function.array-merge]: Argument #2 is not an array in C:\AppServ\www\php\php5.php on line 7  Warning: array_merge() [function.array-merge]: Argument #4 is not an array in C:\AppServ\www\php\php5.php on line 7  ......

阅读全文(1122) | 评论:0

php实现将xml转换成数组(2008-12-12 13:42:00)

摘要:<?  header("Content-Type: text/html; charset=gb2312");  $t=new xml2array();  $t->str="http://***.com/qiminphp.xml";  $m=$t->xarray(); class xml2array{        public $str = '';        public $type = 1; //0为字符串,1为文件                function readxml(){                if($this->type==1){                        $this->xmlstr = simplexml_load_file($this->str);                }else{                        $this->xmlstr = simplexml_lo......

阅读全文(5049) | 评论:0

ajax通过post提交中文数据的乱码的解决(2008-12-03 13:14:00)

摘要:提交前中文数据用encodeURIComponent(js的函数) 编码,然后提交到服务器端用urldecode(php函数)解码,然后用iconv("UTF-8", "gb2312", $content)进行编码转换页面编码用的是gb2312......

阅读全文(2511) | 评论:0

php输出二维数组(2008-12-03 09:55:00)

摘要:$r是一个二维数据,以下是将其输出foreach ($r as $arrItem){   echo $arrItem[name];} ......

阅读全文(2179) | 评论:0

php生成缩微图(2008-12-01 18:03:00)

摘要:<?// 本函数从源文件取出图象,设定成指定大小,并输出到目的文件// 源文件格式:gif,jpg,,png// 目的文件格式:jpg// $srcFile: 源文件// $dstFile: 目标文件// $dstW: 目标图片宽度// $dstH: 目标文件高度function makethumb($srcFile,$dstFile,$dstW,$dstH) {  $data = GetImageSize($srcFile,&$info);  switch ($data[2]) {    case 1:        $im = @ImageCreateFromGIF($srcFile);        break;    case 2:        $im = @imagecreatefromjpeg($srcFile);            break;    case 3:        $im = @ImageCreateFromPNG($srcFile);            break;  }  $srcW=ImageSX($im);  $srcH=ImageSY($im);  $ni=ImageCreate($dstW,$dstH);  ImageCopyResized($ni,$im,0,0,0,0,$dstW,$dstH,$srcW,$srcH);  //ImageJpeg($ni);  ImageJpeg($ni,$dstFile);  // 如果需要输出到浏览器,那......

阅读全文(1859) | 评论:0

php获取表的字段名(2008-11-05 09:18:00)

摘要:<?php$conn=mysql_connect('localhost','root','123456');       //打开连接$fields=mysql_list_fields("alowo","url_link",$conn);     //列出alowo库url_link表的信息$cols=mysql_num_fields($fields);        //获取结果数for($i=0;$i<$cols;$i++)          //循环{  echo mysql_field_name($fields,$i)."\n";       //输出字段名 echo "<p>";}?>......

阅读全文(3409) | 评论:0