Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

php³£ÓõÄÕýÔò¹ýÂË


$str=preg_replace("/\s+/", " ", $str); //¹ýÂ˶àÓà»Ø³µ   
$str=preg_replace("/<[ ]+/si","<",$str); //¹ýÂË<__("<"ºÅºóÃæ´ø¿Õ¸ñ)   
  
$str=preg_replace("/<\!--.*?-->/si","",$str); //×¢ÊÍ   
$str=preg_replace("/<(\!.*?)>/si","",$str); //¹ýÂËDOCTYPE   
$str=preg_replace("/<(\/?html.*?)>/si","",$str); //¹ýÂËhtml±êÇ©   
$str=preg_replace("/<(\/?head.*?)>/si","",$str); //¹ýÂËhead±êÇ©   
$str=preg_replace("/<(\/?meta.*?)>/si","",$str); //¹ýÂËmeta±êÇ©   
$str=preg_replace("/<(\/?body.*?)>/si","",$str); //¹ýÂËbody±êÇ©   
$str=preg_replace("/<(\/?link.*?)>/si","",$str); //¹ýÂËlink±êÇ©   
$str=preg_replace("/<(\/?form.*?)>/si","",$str); //¹ýÂËform±êÇ©   
$str=preg_replace("/cookie/si","COOKIE",$str); //¹ýÂËCOOKIE±êÇ©   
  
$str=preg_replace("/<(applet.*?)>(.*?)<(\/applet.*?)>/si","",$str); //¹ýÂËapplet±êÇ©   
$str=preg_replace("/<(\/?applet.*?)>/si","",$str); //¹ýÂËapplet±êÇ©   
  
$str=preg_replace("/<(style.*?)>(.*?)<(\/style.*?)>/si","",$str); //¹ýÂËstyle±êÇ©   
$str=preg_replace("/<(\/?style.*?)>/si","",$str); //¹ýÂËstyle±êÇ©   
  
$str=preg_replace("/<(title.*?)>(.*?)<(\/title.*?)>/si","",$str); //¹ýÂËtitle±êÇ©   
$str=preg_replace("/<(\/?title.*?)>/si","",$str); //¹ýÂËtitle±êÇ©   
  
$str=preg_replace("/<(object.*?)>(.*?)<(\/object.*?)>/si","",$str); //¹ýÂËobject±êÇ©   
$str=preg_replace("/<(\/?objec.*?)>/si","",$str); //¹ýÂËobject±êÇ©   
  
$str=preg_replace("/<(noframes.*?)>(.*?)<(\/noframes.*?)>/si","",$str); //¹ýÂËnoframes±êÇ©   
$str=preg_replace("/<(\/?noframes.*?)>/si","",$str); //¹ýÂËnoframes±êÇ©   


Ïà¹ØÎĵµ£º

PHPÊý¾Ý¿âÁ´½Ó´úÂë

 <?php
$mydbhost ="localhost"; //ÅäÖÃÖ÷»ú
$mydbuser ="root"; //Êý¾Ý¿âÓû§
$mydbpw ="8312836"; //Êý¾Ý¿âÃÜÂë
$mydbname ="jingyun"; //Êý¾Ý¿âÃû
//$mydbcharset ="GBK";
$conn=mysql_connect($mydbhost,$mydbuser,$mydbpw) or die ("·þÎñÆ÷Á¬½Ó´íÎó".mysql_error());
mysql_select_db($myd ......

PHPÖÐÎÄÂÒÂë½â¾ö°ì·¨


Ò»£®         Ê×ÏÈÊÇPHPÍøÒ³µÄ±àÂë
1.     phpÎļþ±¾ÉíµÄ±àÂëÓëÍøÒ³µÄ±àÂëӦƥÅä
a.     Èç¹ûÓûʹÓÃgb2312±àÂ룬ÄÇôphpÒªÊä³öÍ·£ºheader(“Content-Type: text/html; charset=gb2312")£¬¾²Ì¬Ò³ÃæÌí¼Ó<meta http-equiv="Cont ......

php»ñÈ¡³ÌÐòÖ´ÐеÄʱ¼ä

ÔÚhead.htmÖмÓÈ룬Ҳ¾ÍÊÇÔÚĬÈÏÄ£°æÖÐÌí¼Ó“$stime=microtime(true); //»ñÈ¡³ÌÐò¿ªÊ¼Ö´ÐеÄʱ¼ä”
¾ä
<!--<?php
$stime=microtime(true); //»ñÈ¡³ÌÐò¿ªÊ¼Ö´ÐеÄʱ¼ä
$GuideFid[$fid]=str_replace("<a href='$webdb[www_url]' class='guide_menu'>>Ê×Ò³</a>","",$GuideFid[$fid]);
$f ......

³£ÓÃʱ¼ä¸ñʽÓëPHPʱ¼ä¸ñʽÏ໥ת»»

ÎÄ/Fenying
 
¡¡¡¡ÀýÈçÓг£ÓÃʱ¼ä¸ñʽ yyyy-mm-dd HH:ii:ss£¬ÈçºÎת»»³ÉPHPÖÐdateº¯Êý¿ÉʹÓõÄʱ¼ä¸ñÊ½ÄØ£¿
¡¡¡¡Ê¹ÓàPHPTimeFormatfromCommon() ¿ÉÒÔ°ÑͨÓÃʱ¼ä¸ñʽת»»³ÉPHPʱ¼ä¸ñʽ
¡¡¡¡¡¡¡¡PHPTimeFormatfromCommon('yyyy-mm-dd HH:ii:ss') => 'Y-m-d H:i:s'
¡¡¡¡Ê¹Óà PHPTimeFormatToCommon() ¿ÉÒÔ° ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ