Time of Update: 2017-01-13
public function removePic($pic){ if(@unlink($this->path.$pic) && @unlink($this->path.str_replace($this->pre_thumb,$this->pre_pic,$pic))) { &
Time of Update: 2017-01-13
header("Content-Type:text/html;charset=gbk");$message=$_POST['message'];$contents = @file_get_contents("$message");if($contents=="Forbidden"){ $ch = curl_init(); $timeout = 5; curl_setopt ($ch,
Time of Update: 2017-01-13
php ,類比,搜尋引擎,訪問網頁時是否帶有一些相關參數下面我們就來模仿搜尋引擎訪問網站吧。<?phpfunction GetPage($url){$buf=parse_url($url);if($buf['scheme']=="http")//如果是URL { $host=$buf['host']; $page=$buf['path']; if(trim($buf['query'])!=="") $page.
Time of Update: 2017-01-13
class ChineseNumber{var $basical=array(0=>"零","一","二","三","四","五","六","七","八","九");//var
Time of Update: 2017-01-13
ereg() ereg_replace() eregi() eregi_replace() split() (1)ereg,eregi 這是正規運算式匹配函數,前者是大小寫有關匹配,後者則是無關的. 用法: ereg(正規運算式,字串,[匹配部分數組名]); PHP3.0中的正規運算式大體類似於grep中用的. (2)ereg_replace,eregi_replace 這些是替換函數. 用法: ereg_replace(正規運算式,替換串,原字串);
Time of Update: 2017-01-13
php isset() 與unset函數用法與區別很顯了,isset是判斷變數是否在存,而unset 是消除變數,下面我們來看看實現吧。<?php$a = 1;echo isset($a)?'中國WEB第一站':'www.111cn.net';unset($a);echo
Time of Update: 2017-01-13
switch($id){ case 1: return 'asp/'; break; case 2: return 'phper/'; break; case 3: return
Time of Update: 2017-01-13
$fileName = md5_filename($rs[0],$rs['z_a'],$rs['filesendid']); $path = get_path($rs['sysa']).$rs['z_a'].'/'; $parent =
Time of Update: 2017-01-13
function htmlTemplate($tag){ $url ="file.txt";//file檔案裡面儲存的是我要所資料並且是以<!-- 內容 -->為界線的。 $content = file_get_contents($url); 讀取檔案 if( !empty( $content ) ){ $array =
Time of Update: 2017-01-13
function insert_file($file,$replace=''){ global
Time of Update: 2017-01-13
explode(符號,字元)由explode處理的字元最後會分成一個數組形式儲存了,下面我們來看一個執行個體。$t ='9,133,儋縣^14,203,長沙^14,206,衡陽';$ar = explode(',',$a);print_r($ar);//上面必須用print_r如果用echo只會輸出array哦,得出結果為:Array( [0] => 9,133,儋縣 [1] => 14,203,長沙
Time of Update: 2017-01-13
php serialize,unserialize 函數在php中我們經常會看到serialize,unserialize這兩個函數,那麼他們的作用是什麼呢,serialize可把任何資料轉換成可儲存的字元哦,然後再unserialize還原,下面我們來看個執行個體。$array = array('"'','/"','union','bbb');$a =serialize($array);echo
Time of Update: 2017-01-13
例子<?php $date1="2006-05-25 17:50:38"; echo date("Y/m/d",strtotime($date1)); ?>date("Y-m-d
Time of Update: 2017-01-13
/** * 文本轉HTML * * @param string $txt; * return string; */function Text2Html($txt){ $txt = str_replace(" "," ",$txt); $txt =
Time of Update: 2017-01-13
<?phpfunction ubb($string) { $searcharray['bbcode_regexp'] = array( "/s*[quote][nr]*(.+?)[nr]*[/quote]s*/is", "/([box=(#[0-9A-F]{6}|[a-z]+)])[nr]*(.+?)[nr]*([/box])/is", &
Time of Update: 2017-01-13
session_start();$enablegd = 1;$funcs = array('imagecreatetruecolor','imagecolorallocate','imagefill','imagestring','imageline','imagerotate','imagedestroy','imagecolorallocatealpha','imageellipse','imagepng');foreach($funcs as
Time of Update: 2017-01-13
if(strpos($fileurl, ':/'))//遠程檔案{ header("Location: $fileurl");}else//本地檔案{ if($d == 0) { header("Location: ".SITE_URL.$fileurl); } else { $fileurl = file_exists($fileurl) ?
Time of Update: 2017-01-13
if(isset($gd) && $gd==1 && $txt){ header ("Content-type: image/png"); $txt = urldecode(phpcms_auth($txt, 'DECODE', AUTH_KEY)); $imageX = strlen($txt)*9; $im = @imagecreate ($imageX, 16) or die
Time of Update: 2017-01-13
define('IP', ip());define('HTTP_REFERER', isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');define('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : preg_replace("/(.*).php(.*)/i", "\1.php",
Time of Update: 2017-01-13
php switch break case 使用教程switch在很多語言中都會有只是表達試不一樣了,下面我們來看看break case /* 1,600-800^2,800-1000^3,1000-1200^4,1200-1500^5,1500-2000^6,2000-3000^7,3000-5000^8,5000-8000^9,8000-10000