php 將檔案壓縮為zip檔案

PHP ZipArchive 是PHP內建的擴充類,可以輕鬆實現ZIP檔案的壓縮和解壓,使用前首先要確保PHP ZIP 擴充已經開啟。 /* 說明: 將多個檔案壓縮成一個zip檔案的函數 * @param $files 數群組類型 * @param destination 目標檔案的路徑 * @param $overwrite 是否為覆蓋與目標檔案相同的檔案 */function create_zip($files = array(),$destination

php編寫的簡單隨機抽獎函數

/** * “抽獎”函數 * * @param integer $first 起始編號 * @param integer $last 結束編號 * @param integer $total 獲獎人數 * * @return string **/function isWinner($first, $last, $total){ $winner = array(); for ($i=0;;$i++) { $number =

php不破壞單詞截取子字串

php不破壞單詞截取子字串 /* snippet(phrase,[max length],[phrase tail]) snippetgreedy(phrase,[max length before next space],[phrase tail]) */ function snippet($text,$length=64,$tail="...") { $text = trim($text); $txtl = strlen($text);

php實現檔案下載!

實現php檔案安全下載! public function downloads($name){ $name_tmp = explode("_",$name); $type = $name_tmp[0]; $file_time = explode(".",$name_tmp[3]); $file_time = $file_time[0]; $file_date = date("Y/md",$file_time);

一個完整的圖片上傳php類

這個php圖片上傳類功能非常完善,完全可以滿足各種圖片上傳需求 /************************************** seesaw associates | http://seesaw.net client: file: description: Copyright (C) 2008 Matt Kenefick(.com)**************************************/ class mk_imageUpload{

php快速排序的演算法

function qsort(&$arr){ _quick_sort($arr, 0, count($arr) - 1);} /** * 採用遞迴演算法的快速排序。 * * @param array $arr 要排序的數組 * @param int $low 最低的排序子段 * @param int $high 最高的排序欄位 */function _quick_sort(&$arr, $low, $high){ $low_data = $arr[$low];

php計算兩個座標(經度,緯度)之間的距離

php計算兩個座標(經度,緯度)之間的距離,返回結果為米或者千米 function distance($lat1, $lng1, $lat2, $lng2, $miles = true){ $pi80 = M_PI / 180; $lat1 *= $pi80; $lng1 *= $pi80; $lat2 *= $pi80; $lng2 *= $pi80; $r = 6372.797; // mean radius of Earth in km

物件導向的php操作mssql類

/*untested*/ class database_mssql { var $database = NULL;var $sqls = NULL; var $host = NULL;var $username = NULL;var $password = NULL;var $databaseName = NULL;var $link = NULL;var $queries = NULL;var $errors = NULL; function database_mssql($host,

PHP封裝了一個DB資料庫 mysql 的類

// 設定資料庫 define('DB_HOST', '127.0.0.1'); //伺服器位址 define('DB_USER', 'root'); //使用者名稱 define('DB_PASS', ''); //密碼 define('DB_DATABASENAME', 'fenxiao'); //資料庫 class Dbmysql { /* *變數 **/ private $tablename=""; //表名 private $fieldname="*";

一個很好的PHP驗證類

/** * 驗證類 * * @lastmodify 2014-5-16 * @author jy625 */ class VerifyAction{ /** * 是否為空白值 */ public static function isEmpty($str){ $str = trim($str);

PHP遍曆目錄的代碼

PHP目錄的遍曆 //php目錄的遍曆function showDetail($dirname){$ds = opendir($dirname);while($file = readdir($ds)){$path = $dirname."/".$file;if($file != "." && $file != ".."){ //這裡是個坑if(is_dir($path)){showDetail($path);

php的httpClient 類

class httpClient { public $buffer = null; // buffer 擷取返回的字串 public $referer = null; // referer 設定 HTTP_REFERER 的網址 public $response = null; // response 伺服器響應的 header 資訊 public $request = null; // request 發送到伺服器的

PHP限制檔案下載的速度

// local file that should be send to the client$local_file = 'test-file.zip';// filename that the user gets as default$download_file = 'your-download-name.zip'; // set the download rate limit (=> 20,5 kb/s)$download_rate = 20.5;

使用新浪IP庫擷取IP詳細地址

使用新浪IP庫擷取IP詳細地址class Tool{ /** * 擷取IP的歸屬地( 新浪IP庫 ) * * @param $ip String IP地址:112.65.102.16 * @return Array */ static public function getIpCity($ip) { $ip =

Laravel 5.1 使用使用者名稱登入

如果你稍微研究下laravel登入的話,能找到這段代碼public function loginUsername(){ return property_exists($this, 'username') ? $this->username : 'email';}複製代碼這裡做了判斷 是否存在屬性username 沒有及用email.所以想用使用者名稱登入的話,就直接改下AuthController.php 增加個username的屬性就OK了。protected $username = '

PHP無限分類[增強版]

/** +------------------------------------------------ * 通用的樹型類 +------------------------------------------------ * @author yangyunzhou@foxmail.com +------------------------------------------------ * @date 2010年11月23日10:09:31 +------------------------

一個多功能的php圖片處理類

圖片處理函數功能:縮放、剪下、相框、浮水印、銳利化、旋轉、翻轉、透明度、反色,處理並儲存記錄的思路:當有圖片有改動時自動產生一張新圖片,命 名方式可以考慮在原圖片的基礎上加上步驟,例如:圖片名稱+__第幾步。 在一些需要圖片進階處理功能的Web應用中,可以參考這個類。 /*圖片處理函數功能:縮放、剪下、相框、浮水印、銳利化、旋轉、翻轉、透明度、反色處理並儲存記錄的思路:當有圖片有改動時自動產生一張新圖片,命名方式可以考慮在原圖片的基礎上加上步驟,例如:圖片名稱+__第幾步*/class

iOS程式猿如何快速掌握 PHP,化身"全棧攻城獅"?

這是一篇以 iOS 開發人員的視角寫給廣大iOS 程式猿的 PHP 入門指南.在這篇文章裡我努力去發掘 objectiv-c 與 php 之間的共性,來協助有一定 iOS

一個簡單的php分頁類代碼

class Page { private $total; //資料表中總記錄數 private $listRows; //每頁顯示行數 private $limit; private $uri; private $pageNum; //頁數 private $config=array('header'=>"個記錄", "prev"=>"上一頁", "next"=>"下一頁", "first"=>"首 頁",

一個簡潔的PHP可逆加密函數

很多時候我們需要對資料進行加密解密,比如有些資料需要儲存到cookie中,但又不能被使用者輕易得到這些資料,這時我們就需要加密這些資料儲存到cookie中,等我們需要使用它們的時候再解密。 // 加密資料並寫到cookie裡$cookie_data = $this -> encrypt("nowamagic", $data); $cookie = array( 'name' => '$data', 'value' => $cookie_data,

總頁數: 5203 1 .... 1870 1871 1872 1873 1874 .... 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.