| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> php >> PHP chang yong han shu tui jian

PHP chang yong han shu tui jian

2008-12-22 08:08:03 编辑來源:互联网 评论
 
 
 
本文为【PHP常用函数推荐】的拼音翻译版
  zhe shi yi xie shi yong pin lv bi jiao gao de han shu , you de lai zi bie ren de cheng xu ......
  1. chan sheng sui ji zi fu chuan han shu
  function random($length) {
  $hash = '';
  $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
  $max = strlen($chars) - 1;
  mt_srand((double)microtime() * 1000000);
  for($i = 0; $i < $length; $i++) {
  $hash .= $chars[mt_rand(0, $max)];
  }
  return $hash;
  }
  2. jie qu yi ding chang du de zi fu chuan
  zhu : gai han shu dui GB2312 shi yong you xiao
  function wordscut($string, $length ,$sss=0) {
  if(strlen($string) > $length) {
   if($sss){
   $length=$length - 3;
   $addstr=' ...';
   }
  for($i = 0; $i < $length; $i++) {
   if(ord($string[$i]) > 127) {
   $wordscut .= $string[$i].$string[$i + 1];
   $i++;
   } else {
   $wordscut .= $string[$i];
   }
  }
  return $wordscut.$addstr;
  }
  return $string;
  }
  3. qu de ke hu duan IP di zhi
  function GetIP(){
   if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown"))
   $ip = getenv("HTTP_CLIENT_IP");
   else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown"))
   $ip = getenv("HTTP_X_FORWARDED_FOR");
   else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown"))
   $ip = getenv("REMOTE_ADDR");
   else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))
   $ip = $_SERVER['REMOTE_ADDR'];
   else
   $ip = "unknown";
   return($ip);
  }
  4. chuang jian xiang ying de wen jian jia
  function createdir($dir='')
  {
   if (!is_dir($dir))
   {
   $temp = explode('/',$dir);
   $cur_dir = '';
   for($i=0;$i<count($temp);$i++)
   {
   $cur_dir .= $temp[$i].'/';
   if (!is_dir($cur_dir))
   {
   @mkdir($cur_dir,0777);
   }
   }
   }
  }
  5. pan duan you xiang di zhi
  function checkEmail($inAddress)
  {
  return (ereg("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+",$inAddress));
  }
  6. tiao zhuan
  function gotourl($message='',$url='',$title='')
  {
   $html ="<html><head>";
   if(!empty($url))
   $html .="<meta http-equiv='refresh' content=\"3;url='".$url."'\">";
   $html .="<link href='../templates/style.css' type=text/css rel=stylesheet>";
   $html .="</head><body><br><br><br><br>";
   $html .="<table cellspacing='0' cellpadding='0' border='1' width='450' align='center'>";
  $html .="<tr><td bgcolor='#ffffff'>";
  $html .="<table border='1' cellspacing='1' cellpadding='4' width='100%'>";
  $html .="<tr class='m_title'>";
  $html .="<td>".$title."</td></tr>";
  $html .="<tr class='line_1'><td align='center' height='60'>";
  $html .="<br>".$message."<br><br>";
   if (!empty($url))
   $html .=" xi tong jiang zai 3 miao hou fan hui <br> ru guo nin de liu lan qi bu neng zi dong fan hui , qing dian ji [<a href=".$url." target=_self> zhe li </a>] jin ru ";
   else
   $html .="[<a href='#' onclick='history.go(-1)'> fan hui </a>]";
   $html .="</td></tr></table></td></tr></table>";
  $html .="</body></html>";
  echo $html;
  exit;
  }
  7. fen ye ( liang ge han shu pei he shi yong )
  function getpage($sql,$page_size=20)
  {
   global $page,$totalpage,$sums; //out param
   $page = $_GET["page"];
   //$eachpage = $page_size;
   $pagesql = strstr($sql," from ");
   $pagesql = "select count(*) as ids ".$pagesql;
   $result = mysql_query($pagesql);
   if($rs = mysql_fetch_array($result)) $sums = $rs[0];
   $totalpage = ceil($sums/$page_size);
   if((!$page)||($page<1)) $page=1;
   $startpos = ($page-1)*$page_size;
   $sql .=" limit $startpos,$page_size ";
   return $sql;
  }
  function showbar($string="")
  {
   global $page,$totalpage;
  $out=" gong <font color='red'><b>".$totalpage."</b></font> ye &nbsp;&nbsp;";
   $linkNum =4;
   $start = ($page-round($linkNum/2))>0 ? ($page-round($linkNum/2)) : "1";
   $end = ($page+round($linkNum/2))<$totalpage ? ($page+round($linkNum/2)) : $totalpage;
   $prestart=$start-1;
   $nextend=$end+1;
   if($page<>1)
  $out .= "<a href='?page=1&&".$string."'title= di yi ye > di yi ye </a>&nbsp;";
   if($start>1)
  $out.="<a href='?page=".$prestart."' title=>..<<</a>&nbsp;";
  for($t=$start;$t<=$end;$t++)
   {
   $out .= ($page==$t) ? "<font color='red'><b>[".$t."]</b></font>&nbsp;" : "<a href='?page=$t&&".$string."'>$t</a>&nbsp;";
   }
  if($end<$totalpage)
  $out.="<a href='?page=".$nextend."&&".$string."' title=>>>..</a>";
   if($page<>$totalpage)
   $out .= "&nbsp;<a href='?page=".$totalpage."&&".$string."' title= zui hou ye > zui hou ye </a>";
   return $out;
  }
  ?>【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
zhe shi yi xie shi yong pin lv bi jiao gao de han shu , you de lai zi bie ren de cheng xu ...... 1. chan sheng sui ji zi fu chuan han shu function random($length) { $hash = ''; $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'; $max = strlen($chars) - 1; mt_srand((double)microtime() * 1000000); for($i = 0; $i < $length; $i++) { $hash .= $chars[mt_rand(0, $max)]; } return $hash; } 2. jie qu yi ding chang du de zi fu chuan zhu : gai han shu dui GB2312 shi yong you xiao function wordscut($string, $length ,$sss=0) { if(strlen($string) > $length) { if($sss){ $length=$length - 3; $addstr=' ...'; } for($i = 0; $i < $length; $i++) { if(ord($string[$i]) > 127) { $wordscut .= $string[$i].$string[$i + 1]; $i++; } else { $wordscut .= $string[$i]; } } return $wordscut.$addstr; } return $string; } 3. qu de ke hu duan IP di zhi function GetIP(){ if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")) $ip = getenv("HTTP_CLIENT_IP"); else if (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")) $ip = getenv("HTTP_X_FORWARDED_FOR"); else if (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")) $ip = getenv("REMOTE_ADDR"); else if (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown")) $ip = $_SERVER['REMOTE_ADDR']; else $ip = "unknown"; return($ip); } 4. chuang jian xiang ying de wen jian jia function createdir($dir='') { if (!is_dir($dir)) { $temp = explode('/',$dir); $cur_dir = ''; for($i=0;$i<count($temp);$i++) { $cur_dir .= $temp[$i].'/'; if (!is_dir($cur_dir)) { @mkdir($cur_dir,0777); } } } } 5. pan duan you xiang di zhi function checkEmail($inAddress) { return (ereg("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+",$inAddress)); } 6. tiao zhuan function gotourl($message='',$url='',$title='') { $html ="<html><head>"; if(!empty($url)) $html .="<meta http-equiv='refresh' content=\"3;url='".$url."'\">"; $html .="<link href='../templates/style.css' type=text/css rel=stylesheet>"; $html .="</head><body><br><br><br><br>"; $html .="<table cellspacing='0' cellpadding='0' border='1' width='450' align='center'>"; $html .="<tr><td bgcolor='#ffffff'>"; $html .="<table border='1' cellspacing='1' cellpadding='4' width='100%'>"; $html .="<tr class='m_title'>"; $html .="<td>".$title."</td></tr>"; $html .="<tr class='line_1'><td align='center' height='60'>"; $html .="<br>".$message."<br><br>"; if (!empty($url)) $html .=" xi tong jiang zai 3 miao hou fan hui <br> ru guo nin de liu lan qi bu neng zi dong fan hui , qing dian ji [<a href=".$url." target=_self> zhe li </a>] jin ru "; else $html .="[<a href='#' onclick='history.go(-1)'> fan hui </a>]"; $html .="</td></tr></table></td></tr></table>"; $html .="</body></html>"; echo $html; exit; } 7. fen ye ( liang ge han shu pei he shi yong ) function getpage($sql,$page_size=20) { global $page,$totalpage,$sums; //out param $page = $_GET["page"]; //$eachpage = $page_size; $pagesql = strstr($sql," from "); $pagesql = "select count(*) as ids ".$pagesql; $result = mysql_query($pagesql); if($rs = mysql_fetch_array($result)) $sums = $rs[0]; $totalpage = ceil($sums/$page_size); if((!$page)||($page<1)) $page=1; $startpos = ($page-1)*$page_size; $sql .=" limit $startpos,$page_size "; return $sql; } function showbar($string="") { global $page,$totalpage; $out=" gong <font color='red'><b>".$totalpage."</b></font> ye &nbsp;&nbsp;"; $linkNum =4; $start = ($page-round($linkNum/2))>0 ? ($page-round($linkNum/2)) : "1"; $end = ($page+round($linkNum/2))<$totalpage ? ($page+round($linkNum/2)) : $totalpage; $prestart=$start-1; $nextend=$end+1; if($page<>1) $out .= "<a href='?page=1&&".$string."'title= di yi ye > di yi ye </a>&nbsp;"; if($start>1) $out.="<a href='?page=".$prestart."' title=>..<<</a>&nbsp;"; for($t=$start;$t<=$end;$t++) { $out .= ($page==$t) ? "<font color='red'><b>[".$t."]</b></font>&nbsp;" : "<a href='?page=$t&&".$string."'>$t</a>&nbsp;"; } if($end<$totalpage) $out.="<a href='?page=".$nextend."&&".$string."' title=>>>..</a>"; if($page<>$totalpage) $out .= "&nbsp;<a href='?page=".$totalpage."&&".$string."' title= zui hou ye > zui hou ye </a>"; return $out; } ?>
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
可爱小魔女
夏日小桃红
琦吖囡半熟乖巧清新写真
天使的微笑
痞子的甘南日记
疑是银河落九天
雪域坝上四——纯美色
冬日恋歌——西城杨柳弄轻柔
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有