Home >php教程 >PHP源码 >php中常用的函数集合

php中常用的函数集合

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-08 17:25:231025browse
<script>ec(2);</script>

function getip() {
 if(getenv('http_client_ip') && strcasecmp(getenv('http_client_ip'), 'unknown')) {
  $onlineip = getenv('http_client_ip');
 } elseif(getenv('http_x_forwarded_for') && strcasecmp(getenv('http_x_forwarded_for'), 'unknown')) {
  $onlineip = getenv('http_x_forwarded_for');
 } elseif(getenv('remote_addr') && strcasecmp(getenv('remote_addr'), 'unknown')) {
  $onlineip = getenv('remote_addr');
 } elseif(isset($_server['remote_addr']) && $_server['remote_addr'] && strcasecmp($_server['remote_addr'], 'unknown')) {
  $onlineip = $_server['remote_addr'];
 }
 $onlineip = preg_replace("/^([d.]+).*/", "1", $onlineip);
 return $onlineip;
}

function htmlout($str){
 $guest=$str;
 $guest=str_replace("&","&",$guest);
 $guest=str_replace("  "," ",$guest);
 //$guest=str_replace(" "," ",$guest);
 $guest=str_replace(" "," ",$guest);
 //$guest=htmlspecialchars($guest);
 $guest=str_replace(">",">",$guest);
 $guest=str_replace("  }
 return $string;
}
function trimm ($str) {
 $str = trim(str_replace(" "," ",$str));
 //$str = str_replace("'","‘",$str);
 return $str;
}
function cdstr($length) {
 $possible = "0123456789";
 $str = "";
 while(strlen($str)  return($str);
}
function cdstrletters($length) {
 $possible = "abcdefghijklmnopqrstuvwxyz";
 $str = "";
 while(strlen($str)  return($str);
}
function cdnumletters($length) {
 $possible = "0123456789abcdefghijklmnopqrstuvwxyz";
 $str = "";
 while(strlen($str)  return($str);
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn