php資料處理公用類

/*==================================================================*/ /* 檔案名稱:BaseLogic.class.php */ /* 概要: 資料處理公用類. */ class BaseLogic extends MyDB {

php實現http登陸驗證

/* http認證 判斷來路頁面 寫日誌 */ ////////////禁用錯誤報表////////////// error_reporting(0); ///////////http認證//////////// if(!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="login:"');

php處理檔案下載的代碼

用在伺服器上提供下載的php代碼,可以指定被下載的檔案名稱,可以動態指定檔案內容 // local file that should be send to the client$local_file = 'test.zip';// filename that the user gets as default$download_file = 'your-download-name.zip'; if(file_exists($local_file) && is_file($local_file))

PHP遞迴對檔案夾遞迴執行chmod命令

function recursiveChmod($path, $filePerm=0644, $dirPerm=0755) { // Check if the path exists if(!file_exists($path)) { return(FALSE); } // See whether this is a file if(is_file($path)) { // Chmod

PHP將時間格式化幾天前、幾分鐘前等

class DateFormat{ private static $_DIFF_FORMAT = array( 'DAY' => '%s天前', 'DAY_HOUR' => '%s天%s小時前', 'HOUR' => '%s小時', 'HOUR_MINUTE' => '%s小時%s分前', 'MINUTE' => '%s分鐘前',

php常用Regex

class Verify{ /** * 驗證使用者名稱 * @param string $value * @param int $length * @return boolean */ public static function isNames($value, $minLen=2, $maxLen=20, $charset='ALL'){ if(empty($value)) return false; switch($charset)

PHP數組產生 CSV 檔案

一個很簡單的功能,從一個PHP數組產生一個.csv檔案。此函數使用 fputcsv PHP 內建函數產生逗點分隔檔(.CSV)。該函數有3個參數:資料,分隔字元和CSV enclosure,預設是雙引號。 function generateCsv($data, $delimiter = ',', $enclosure = '"') { $handle = fopen('php://temp', 'r+'); foreach ($data as $line)

PHP終極加密功能

// f(ucking) u(ncrackable) e(ncryption) function by BlackHatDBL (www.netforme.net) function fue($hash,$times) { // Execute the encryption(s) as many times as the user wants for($i=$times;$i>0;$i--) { // Encode

PHP實現zip壓縮解壓通用函數

function ezip($zip, $hedef = ''){ $dirname=preg_replace('/.zip/', '', $zip); $root = $_SERVER['DOCUMENT_ROOT'].'/zip/'; // echo $root. $zip; $zip = zip_open($root . $zip); // var_dump($zip); @mkdir($root . $hedef .

PHP Socket 編程實現

最近在做的項目有一項需要耗時任務在後台啟動並執行功能,雖然PHP並不是非常適合做常駐背景守護進程,但是由於項目主要代碼都是基於PHP實現,如 果運行在背景守護進程改換別的語言會非常不方便。所以不可避免會涉及到Web端和Daemon部分的通訊,Socket是一個不錯的方式。 Socket是什麼 socket的英文原義是“孔”或“插座”。作為BSD

php實用擷取遠程圖片的通用方法

function auto_save_image($body){$img_array = explode('&',$body);/*$img_array = array();preg_match_all("/(src)=[\"|\'| ]{0,}(http:\/\/(.*)\.(gif|jpg|jpeg|bmp|png))[\"|\'| ]{0,}/isU", $body, $img_array);$img_array = array_unique($img_array[2]);*/

php實現base64的編碼和解碼

class encryptCalss{ var $key=12; function encode($txt){ for($i=0;$i $txt[$i]=chr(ord($txt[$i])+$this->key); } return $txt=urlencode(base64_encode(urlencode($txt))); } function decode($txt){

遍曆某檔案夾下的所有檔案和檔案夾php代碼

php遍曆某檔案夾下的所有檔案和檔案夾 function list_dir($dirpath){ if($dirpath[strlen($dirpath)-1]!="\\"){$dirpath.="\\";} static $result_array=array(); if(is_dir($dirpath)){ $handle=opendir($dirpath);

產生一定數量的不重複隨機數的PHP代碼

產生一定數量的不重複隨機數 /** array unique_rand( int $min, int $max, int $num )* 產生一定數量的不重複隨機數* $min 和 $max: 指定隨機數的範圍* $num: 指定產生數量*/function unique_rand($min, $max, $num) { $count = 0; $return = array(); while ($count $return[] = mt_rand($min,

php產生圖片縮圖代碼類

產生多種類型的縮圖 /****************************************作者:落夢天蠍(beluckly)*完成時間:2006-12-18*類名:CreatMiniature*功能:產生多種類型的縮圖*基本參數:$srcFile,$echoType*方法用到的參數: $toFile,產生的檔案 $toW,產生的寬 $toH,產生的高

php擷取圖片的exif資訊

php擷取圖片的exif資訊,php內建一個exif_read_data函數可以用來讀取圖片的exif資訊 echo "test1.jpg:\n";$exif = exif_read_data('tests/test1.jpg', 'IFD0');echo $exif===false ? "No header data found.\n" : "Image contains headers\n"; $exif = exif_read_data('tests/test2.jpg', 0,

php實現301永久重新導向

如下代碼實現了301重新導向,301重新導向是一種seo搜尋引擎友好的重新導向方式,其用意是告訴搜尋引擎現在訪問的內容已經轉到其他地址了。 如下是php實現301重新導向的代碼: header("HTTP/1.1 301 Moved Permanently");header("Location: http://www.open-open.com/");複製代碼 常用的重新導向方式有: 301 redirect, 302 redirect 301

php類比post發送資料

$flag = 0; //要post的資料 $argv = array( 'var1'=>'abc', 'var2'=>'你好嗎'); //構造post字串 foreach ($argv as $key=>$value) { if ($flag!=0) { $params .= "&";

實現縮圖和加浮水印的php類

/** * 圖片縮放浮水印類 * * @version 1.0 ; * */class cls_photo{ protected $waterrate = 0.2; //浮水印表徵圖在圖片上的比例 protected $width = 300; //縮圖預設寬度 protected $height = 200; //縮圖預設高度 protected $padding = 5; //浮水印圖到邊的距離 protected $water_mark =

php產生映像縮圖(支援:JPEG,GIT,PNG,BMP)

class Thumb{ public function create($srcPath, $dstPath, $dstWidth, $dstHeight) { if (!file_exists($srcPath)) { return false; } @$srcSize = getimagesize($srcPath); if (empty($srcSize)) { return

總頁數: 5203 1 .... 4885 4886 4887 4888 4889 .... 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.