|  |  |  |  | 
  
  
  
 
| 
| 
 
| 
  
    | 
      
        | PHP动态网页开发中常用的一些函数  |  
        | 
          
            |  |  
            | 来源:互联网  作者:未知  发布时间:2008-01-04 |  
            |  |  |  
        
          | 
 $utf8.=u2utf8(hexdec($codetable[hexdec(bin2hex($this))-0x8080]));
 }
 else
 {
 $gb=substr($gb,1,strlen($gb));
 $utf8.=u2utf8(substr($gb,0,1));
 }
 }
 $ret=\"\";
 for($i=0;$i<strlen($utf8);$i+=3)
 $ret.=chr(substr($utf8,$i,3));
 return $ret;
 }
 function u2utf8($c)
 {
 for($i=0;$i<count($c);$i++)
 $str=\"\";
 if ($c < 0x80) {
 $str.=$c;
 }
 else if ($c < 0x800) {
 $str.=(0xc0 | $c>>6);
 $str.=(0x80 | $c & 0x3f);
 }
 else if ($c < 0x10000) {
 $str.=(0xe0 | $c>>12);
 $str.=(0x80 | $c>>6 & 0x3f);
 $str.=(0x80 | $c & 0x3f);
 }
 else if ($c < 0x200000) {
 $str.=(0xf0 | $c>>18);
 $str.=(0x80 | $c>>12 & 0x3f);
 $str.=(0x80 | $c>>6 & 0x3f);
 $str.=(0x80 | $c & 0x3f);
 }
 return $str;
 }
 header(\"content-type: image/gif\");
 $im = imagecreate(400,300);
 $bkg = imagecolorallocate($im, 0,0,0);
 phperz.com $clr = imagecolorallocate($im, 255,255,255);
 $fnt = \"wb.ttf\";
 //include(\"gb2utf8.php\");
 $str = gb2utf8(\"中国\");
 imagettftext($im, 20, 0, 10, 20, $clr, $fnt, $str);
 imagegif($im);
 imagedestroy($im);
 ?>
 php程序员站
 |  php程序员之家
 
 
    
        
            | 以下为引用的内容: 
 <?php//对javascript和select部件的结合运用
 //在写程序的过程,我想实现在select对象选中选项后,
 //不需要提交按钮,而直接触发动作,且在动作发生后
 //的页面中要保持所选择的选项。经过形容,终于通过
 //使用javascript及select对象的onchange属性及
 //value值而实现了这种功能。
 //代码如下(文件名为"test.php"):
 www.phperz.com   phperz.com    switch ($mon){case '': echo '请选择您的星座:';break;
 case '1':echo '您的星座是水瓶座';break;
 case '2':echo '您的星座是双鱼座';break;
 case '3':echo '您的星座是白羊座';break;
 case '4':echo '您的星座是金牛座';break;
 case '5':echo '您的星座是双子座';break;
 case '6':echo '您的星座是巨蟹座';break;
 case '7':echo '您的星座是狮子座';break;
 case '8':echo '您的星座是处女座';break;
 case '9':echo '您的星座是天平座';break;
 case '10':echo '您的星座是天蝎座';break;
 case '11':echo '您的星座是射手座';break;
 case '12':echo '您的星座是魔蝎座';break;
 default:break;
 }
 ?>
 <form name="form1">
 <select name="month_select"
 www~phperz~com onchange="#location.href=
 this.options[this.selectedindex].value">
 <option>--请选择你的星座--</option>
 <option value="test.php?mon=1"
 <?php if($mon=="1") echo " selected"; ?>>水瓶座</option>
 <option value="test.php?mon=2"
 <?php if($mon=="2") echo " selected"; ?>>双鱼座</option>
 <option value="test.php?mon=3"
 <?php if($mon=="3") echo " selected"; ?>>白羊座</option>
 <option value="test.php?mon=4"
 <?php if($mon=="4") echo " selected"; ?>>金牛座</option>
 <option value="test.php?mon=5"  www~phperz~com
 <?php if($mon=="5") echo " selected"; ?>>双子座</option>
 <option value="test.php?mon=6"
 <?php if($mon=="6") echo " selected"; ?>>巨蟹座</option>
 <option value="test.php?mon=7"
 <?php if($mon=="7") echo " selected"; ?>>狮子座</option>
 <option value="test.php?mon=8"
 <?php if($mon=="8") echo " selected"; ?>>处女座</option>
 <option value="test.php?mon=9"
 <?php if($mon=="9") echo " selected"; ?>>天平座</option>
 <option value="test.php?mon=10"
 <?php if($mon=="10") echo " selected"; ?>>天蝎座</option>
 <option value="test.php?mon=11"  www~phperz~com
 <?php if($mon=="11") echo " selected"; ?>>射手座</option>
 <option value="test.php?mon=12"
 <?php if($mon=="12") echo " selected"; ?>>魔蝎座</option>
 </select>
 </form>
 
 <?
 $uploadimgurl="mag/";
 $showdatefilename=strftime("%y%m%d%h%m%s");
 if($_get["up"]=="up"){
 $uploadimgname=$_files['pic']['name'];
 $filecount=$_files['pic']['size'];
 $max_file_size=$_post["max_file_size"];
 if ($filecount>$max_file_size){
 echo "<script>alert(\"您上传的图片太大,超过指定的大小了!请重新上传!\")</script>";
 }else{
 $endfilename=strrchr($uploadimgname,".");
 $filepath=$uploadimgurl."arc".$showdatefilename.$endfilename;
 if (strspn(strrchr($uploadimgname,"."),".jpgifjpgif")>3){  php程序员站
 move_uploaded_file($_files['pic']['tmp_name'],$filepath);
 ?>
 <script >
 parent.input.bny.value+='[img]<?=$filepath;?>[/img]<br>'
 location.replace('upload.php')
 </script>
 <?
 }else{
 echo "<script>alert(\"您刚才上传的图片类型不符合要求!\");location.href=\"upload.php\"</script>";
 }
 }
 }
 ?>  www.phperz.com
   phperz.com  |  
 |  
          | 上一页 1 23 下一页 |  
          | [收藏此页] [打印本页] [返回顶部] |  |  
    |  |  |   
|  |   
|  |  | 
 |  |