PHP取得中文字串的首字母

$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

計算檔案大小的php代碼

function dirSize($directoty){ $dir_size=0; if($dir_handle=@opendir($directoty)) { while($filename=readdir($dir_handle)){ $subFile=$directoty.DIRECTORY_SEPARATOR.$filename; if($filename=='.

將linux已耗用時間格式成易讀格式的php代碼

$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[

php檢查日期函數checkdate使用樣本

文法 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

PHP根據一個給定經緯度的點,進行附近地點查詢

實現原理先算出該點周圍的矩形的四個點,然後使用經緯度去直接匹配資料庫中的記錄。 //擷取周圍座標 public function returnSquarePoint($lng, $lat,$distance = 0.5){ $earthRadius = 6378138; $dlng = 2 * asin(sin($distance / (2 * $earthRadius)) / cos(deg2rad($lat))); $dlng =

利用imagick庫把PDF轉成PNG格式的PHP代碼

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);

通過curl登入訪問的PHP代碼

$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);// 執行之後不直接列印出來//

PHP 圖片上傳類並產生縮圖

/*** 上傳圖片*/class imgUpload{ static protected $a; protected $formName; //表單名稱 protected $directory; //檔案上傳至目錄 protected $maxSize; //最大檔案上傳大小 protected $canUpload; //是否可以上傳

php讀寫cookie的代碼

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

PHP產生圖形驗證碼(大小寫字母與數字混合)

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

php通過修改header強製圖片下載的代碼

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:

php利用Zend_Mail發送郵件(實現郵件重設密碼功能)

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'];

繁體和簡體互換的PHP函數

class utf8_chinese{ private $utf8_gb2312; private $utf8_big5; private $data; public function __construct($data){ $this->utf8_gb2312 = $data['sim']; $this->utf8_big5 =

php 利用cookie記錄訪問次數

$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

細數api介面平台,比較各類平台價格。

細數api介面平台,在開發app或者web中不免要用到快遞資料,違章資料等。現在就來數數提供api介面的各類平台以及常用api介面的價格。 彙總資料:api多,免費api也多,但是收費價格貴。Haoservice:資料繁多,價格沒有準確標明多少錢幾次。極速資料:上線不久的網站,數量中等,好在價格便宜。阿凡達資料:今年剛看到的網站,數量中等,價格沒標。易源介面:數量中等,價格沒標

將資料以圖片的形式輸出的PHP代碼

$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($

PHP調用http介面

//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,

圖片上傳並使用ImageMagick產生縮圖

使用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 =

擷取記憶體使用量資訊的PHP代碼

使用這個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

將時間轉成幾天前,幾小時等的格式

將時間轉成幾天前,幾小時等的格式,如: “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";

總頁數: 5203 1 .... 1675 1676 1677 1678 1679 .... 5203 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.