Time of Update: 2016-07-25
$limit = array( //gb2312 拼音排序 array(45217,45252), //A array(45253,45760), //B array(45761,46317), //C array(46318,46825), //D array(46826,47009), //E array(47010,47296), //F array(47297,47613), //G array(47614,48118), //H
Time of Update: 2016-07-25
function dirSize($directoty){ $dir_size=0; if($dir_handle=@opendir($directoty)) { while($filename=readdir($dir_handle)){ $subFile=$directoty.DIRECTORY_SEPARATOR.$filename; if($filename=='.
Time of Update: 2016-07-25
$exec = shell_exec('uptime'); $uptime = explode(' up ', $exec); $uptime = explode(',', $uptime[1]); if (strpos($uptime[0], 'day')) { $time = explode(':', $uptime[1]); echo('Current system uptime is ' . $uptime[0]. ', ' . $time[
Time of Update: 2016-07-25
文法 integer checkdate (int %Month, int $Day, int $Year); 示範代碼 echo "2/29/1900";checkdate (2, 29, 1900)?print " is Valid":print " is not valid";echo "\n";echo "2/29/2000";checkdate (2, 29, 2000)?print " is Valid":print " is not valid";echo
Time of Update: 2016-07-25
實現原理先算出該點周圍的矩形的四個點,然後使用經緯度去直接匹配資料庫中的記錄。 //擷取周圍座標 public function returnSquarePoint($lng, $lat,$distance = 0.5){ $earthRadius = 6378138; $dlng = 2 * asin(sin($distance / (2 * $earthRadius)) / cos(deg2rad($lat))); $dlng =
Time of Update: 2016-07-25
function pdf2png($PDF,$Path){ if(!extension_loaded('imagick')){ return false; } if(!file_exists($PDF)){ return false; } $IM = new imagick(); $IM->setResolution(120,120); $IM->setCompressionQuality(100);
Time of Update: 2016-07-25
$data='username=zjzhoufy@126.com&password=1q2w3e&remember=1';$curlobj = curl_init();// 初始化curl_setopt($curlobj, CURLOPT_URL, "http://www.imooc.com/user/login");// 設定訪問網頁的URLcurl_setopt($curlobj, CURLOPT_RETURNTRANSFER, true);// 執行之後不直接列印出來//
Time of Update: 2016-07-25
/*** 上傳圖片*/class imgUpload{ static protected $a; protected $formName; //表單名稱 protected $directory; //檔案上傳至目錄 protected $maxSize; //最大檔案上傳大小 protected $canUpload; //是否可以上傳
Time of Update: 2016-07-25
setcookie('mycookie','value'); //函數原型:int setcookie(string name,string value,int expire,string path,string domain,int secure) echo($mycookie); echo($HTTP_COOKIE_VARS['mycookie']); echo($_COOKIE['mycookie']); 刪除Cookie (1)調用只帶有name參數的setcookie(); (2
Time of Update: 2016-07-25
header("content-type:image/png"); $num = $_GET['num']; $imagewidth=60; $imageheight=18; srand(microtime() * 100000); $numimage = imagecreate($imagewidth,$imageheight); imagecolorallocate($numimage,183,180,83); for($i=0;$i
Time of Update: 2016-07-25
unction downloadFile($file){ $file_name = $file; $mime = 'application/force-download'; header('Pragma: public'); // required header('Expires: 0'); // no cache header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control:
Time of Update: 2016-07-25
include_once 'conn/conn.php'; require_once 'Zend/Mail.php'; //調用發送郵件的檔案 require_once 'Zend/Mail/Transport/Smtp.php'; //調用SMTP驗證檔案 $reback = '0'; $name = $_GET['foundname']; $question = $_GET['question'];
Time of Update: 2016-07-25
class utf8_chinese{ private $utf8_gb2312; private $utf8_big5; private $data; public function __construct($data){ $this->utf8_gb2312 = $data['sim']; $this->utf8_big5 =
Time of Update: 2016-07-25
$f_open = fopen("count.txt","r+"); //開啟指定的檔案$count = fgets($f_open); //讀取檔案中的資料if(empty($_COOKIE['cookie_name'])){ //判斷COOKIE的是否存在 setcookie("cookie_name",value,time()+1800); //如果不存在,則建立COOKIE $count = $count + 1
Time of Update: 2016-07-25
細數api介面平台,在開發app或者web中不免要用到快遞資料,違章資料等。現在就來數數提供api介面的各類平台以及常用api介面的價格。 彙總資料:api多,免費api也多,但是收費價格貴。Haoservice:資料繁多,價格沒有準確標明多少錢幾次。極速資料:上線不久的網站,數量中等,好在價格便宜。阿凡達資料:今年剛看到的網站,數量中等,價格沒標。易源介面:數量中等,價格沒標
Time of Update: 2016-07-25
$query="select count(ip) as count_ip from tb_count04 ";//查詢資料庫中總的IP訪問量$result=mysql_query($query);$countes=mysql_result($result,0,'count_ip'); //通過GD2函數建立畫布$im=imagecreate(240,24);$gray=imagecolorallocate($im,200,200,200);$color =imagecolorallocate($
Time of Update: 2016-07-25
//http請求介面function curl_http_request($param,$url){ $ch = curl_init(); $curl_url = $url."?".$param; curl_setopt($ch, CURLOPT_URL, $curl_url); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); //禁用認證 curl_setopt($ch,
Time of Update: 2016-07-25
使用ImageMagick,您可以輕鬆,更快地建立縮圖,比使用PHP的容易得多。 // Location to upload main image:$mainDir = $_SERVER['DOCUMENT_ROOT'].'/images/l/';// Location to create the thumb image:$smalDir = $_SERVER['DOCUMENT_ROOT'].'/images/s/';// Command to use:$command =
Time of Update: 2016-07-25
使用這個php代碼,你就可以知道你伺服器上使用RAM(記憶體)的情況。echo "Initial: ".memory_get_usage()." bytes \n";/* printsInitial: 361400 bytes*/// let's use up some memoryfor ($i = 0; $i $array []= md5($i);}// let's remove half of the arrayfor ($i = 0; $i
Time of Update: 2016-07-25
將時間轉成幾天前,幾小時等的格式,如: “1天前”,“2個月前”等。 function prettyDate($date){ $time = strtotime($date); $now = time(); $ago = $now - $time; if($ago $when = round($ago); $s = ($when == 1)?"second":"seconds"; return "$when $s ago";