search
Homephp教程php手册php公用函数列表[正则]

php公用函数列表[正则]

Jun 13, 2016 pm 12:33 PM
phpcodefunctionlistcopyregular

复制代码 代码如下:


/*********************************************************************
* 公用函数列表
* ubb,getip,GoIn,goback,IsInt,InString
* OurHome:http://iwind.org
* http://10.13.31.90/~coldwind

* */
/////////////////ubb支持代码函数////////////////////////////
function ubb($Text) { 
  $Text=trim($Text);
  $Text=htmlspecialchars($Text);  
  $Text=ereg_replace("\n","
",$Text); 
  $Text=preg_replace("/\\t/is","  ",$Text); 
  $Text=preg_replace("/\[h1\](.+?)\[\/h1\]/is","

\\1

",$Text); 
  $Text=preg_replace("/\[h2\](.+?)\[\/h2\]/is","

\\1

",$Text); 
  $Text=preg_replace("/\[h3\](.+?)\[\/h3\]/is","

\\1

",$Text); 
  $Text=preg_replace("/\[h4\](.+?)\[\/h4\]/is","

\\1

",$Text); 
  $Text=preg_replace("/\[h5\](.+?)\[\/h5\]/is","
\\1
",$Text); 
  $Text=preg_replace("/\[h6\](.+?)\[\/h6\]/is","
\\1
",$Text); 
  $Text=preg_replace("/\[center\](.+?)\[\/center\]/is","
\\1
",$Text); 
  $Text=preg_replace("/\[url\](http:\/\/.+?)\[\/url\]/is","\\1",$Text); 
  $Text=preg_replace("/\[url\](.+?)\[\/url\]/is","http://\\1",$Text); 
  $Text=preg_replace("/\[url=(http:\/\/.+?)\](.*)\[\/url\]/is","\\2",$Text); 
  $Text=preg_replace("/\[url=(.+?)\](.*)\[\/url\]/is","\\2",$Text); 
  $Text=preg_replace("/\[img\](.+?)\[\/img\]/is","php公用函数列表[正则]",$Text); 
  $Text=preg_replace("/\[color=(.+?)\](.+?)\[\/color\]/is","\\2",$Text); 
  $Text=preg_replace("/\[size=(.+?)\](.+?)\[\/size\]/is","\\2",$Text); 
  $Text=preg_replace("/\[sup\](.+?)\[\/sup\]/is","\\1",$Text); 
  $Text=preg_replace("/\[sub\](.+?)\[\/sub\]/is","\\1",$Text); 
  $Text=preg_replace("/\[pre\](.+?)\[\/pre\]/is","
\\1
",$Text); 
  $Text=preg_replace("/\[email\](.+?)\[\/email\]/is","\\1",$Text); 
  $Text=preg_replace("/\[i\](.+?)\[\/i\]/is","\\1",$Text); 
  $Text=preg_replace("/\[b\](.+?)\[\/b\]/is","\\1",$Text); 
  $Text=preg_replace("/\[quote\](.+?)\[\/quote\]/is","
quote:
\\1
", $Text); 
  $Text=preg_replace("/\[code\](.+?)\[\/code\]/is","
code:
\\1
", $Text); 
  $Text=preg_replace("/\[sig\](.+?)\[\/sig\]/is","


--------------------------
\\1
--------------------------
", $Text); 
  return $Text; 
}

////////////////取得浏览者的ip地址/////////////////////////////
function getip() { 
   $IP=getenv('REMOTE_ADDR'); 
   $IP_ = getenv('HTTP_X_FORWARDED_FOR'); 
   if (($IP_ != "") && ($IP_ != "unknown")) $IP=$IP_; 
   return $IP; 

function goback($num,$saying){
echo"
$saying";
}
///////////////////判断字符串中是否含有array中的某一值/////////////////
function InString($array,$string){
  while(list(,$value)=each($array)){
   if(eregi($value,$string)){
   return true;
   exit;
  }
  }
}
////////////////////链接到某一页面///////////////////////////////////////
function GoIn($addr,$saying){
echo"
$saying
";
}
////////////////////JS返回//////////////////////////////////////////////
function IsInt($string){
  if(ereg("^[0-9]{0,}$",$string)){
  return true;
  }
   else {
  return false;
  }
}
?>
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)