php去除數組中重複資料的二個例子

/*** 去除數組中重複資料* by bbs.it-home.org**/$input = array("a" => "green","", "red","b" => "green", "","blue", "red","c" => "witer","hello","witer");//$result = array_unique($input); //去除重複元素$result = a_array_unique($input); //只留下單一元素foreach($result as

php GD庫繪製24小時柱狀圖的執行個體代碼

/* 24小時柱狀圖 作者:taokey QQ:29611705* 編輯:bbs.it-home.org*/ function h24($str){ $hour = explode(",",$str); $hmax = max($hour); $ppix = 150/$hmax; //計算柱狀圖高度 $h0 = 190-$hour[0]*$ppix; $h1 = 190-$hour[1]*$ppix; $h2 =

php柱狀圖(JpGraph類庫)的產生方法分享

DEFINE("CACHE_DIR","/tmp/jpgraph_cache/");'   DEFINE("TTF_DIR","/usr/X11R6/lib/X11/fonts/truetype/");複製代碼Windows系統改為:   DEFINE("CACHE_DIR","c:/apache/htdocs/ jpgraph_cache/");'   DEFINE("TTF_DIR","c:/windows/fonts");複製代碼注意事項:

PHP 數組字元集編碼轉換的函數

/** * 數組轉編碼 * @param array $array 待轉碼數組 * @param String $inCharset 原編碼 * @param String $outCharset 轉換後的編碼 * @return $array 轉換後的數組 * @site:bbs.it-home.org */private function arrayCoding ($array, $inCharset, $outCharset) { if (!is_array($array))

PHP壓縮html的函數代碼

//函數名: compress_html//參數: $string//傳回值: 壓縮後的$string//by bbs.it-home.orgfunction compress_html($string) { $string = str_replace("\r\n", '', $string); //清除分行符號 $string = str_replace("\n", '', $string); //清除分行符號 $string = str_replace("\t", '',

php curl偽造IP的範例程式碼

#!/bin/awk -f #運行前 BEGIN { FS = " "; count = 0; } #運行中 { iparr[count ++] = $0; } #運行後 END { printf(" printf("$iparr = array(\n"); for (i = 0; i printf("'%s' => '%s',\n", iparr[i], iparr[i]); }

php報表類庫jpgraph柱狀圖產生執行個體

/*** JpGraph類產生柱狀圖* by bbs.it-home.org*/$datay=array(); //縱座標資料 $datax=array(); //橫座標資料 foreach ($usernums as $key => $value){ $datay[] = $value; $datax[] = $userids[$key]; } require_once (‘jpgraph-3.0.7/jpgraph/jpgraph.php'); require_once

PHP 數字格式化函數number_format的用法

number_format(288); 輸出 288 number_format(365,2); 輸出 365.00 number_format(365000000,3,".") (將數字 365000000 保留3位小數,小數點用"."表示) 輸出: 365,000,000.000 number_format(365000000,2,".","*") (將數字 365000000 保留2位小數,小數點用"."表示,千位分隔字元用"*"表示) 輸出:

php 擷取網站地址的函數代碼

/*** 取得網站的完整地址* by bbs.it-home.org*/function getRootUrl(){ $name = ''; if ( isset($_SERVER['HTTP_HOST']) ){ $name = $_SERVER['HTTP_HOST']; }else{ $name = $_SERVER['SERVER_NAME']; } if ( strpos($name,':') === false && $_SERVER['SERVER_PORT'

php 壓縮多個CSS檔案的實現代碼

/* * 壓縮css檔案 * by bbs.it-home.org /*header('Content-type: text/css');ob_start("compress");function compress($buffer) { /* remove comments */ $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); /* remove tabs, spaces, newlines,

php jquery 多檔案上傳的實現代碼

Upload 複製代碼2,php多檔案上傳代碼 upload.php //If directory doesnot exists create it. $output_dir = "../upload"; if(isset($_FILES["myfile"])) { $ret = array(); $error =$_FILES["myfile"]["error"]; {

按行讀取檔案的代碼(php、c實現)

/** * 按行讀取檔案 * @param string $filename * @site bbs.it-home.org */ function readFileByLine ($filename) { $fh = fopen($filename, 'r'); while (! feof($fh)) { $line = fgets($fh); echo $line; } fclose(

PHP類比POST提交的範例程式碼

/*** PHP中CURL類比Post提交* by bbs.it-home.org*/$url = 'http://website/a.php';$fields = array('UserName'=>urlencode('a'),'PWD'=>urlencode('b') ,'AppReturn'=>urlencode('c') ,'AppSQL'=>urlencode('d') ,);$fields_string = http_build_query($fields);$ch =

php支援斷點續傳的檔案下載類(附源碼)

/** php下載類,支援斷點續傳 * Date: 2013-06-30 * Author: fdipzone * Ver: 1.0 * edit: ww.jbxue.com* Func: * download: 下載檔案 * setSpeed: 設定下載速度 * getRange: 擷取header中Range */ class FileDownload{ // class start private $_speed = 512;

php防止sql注入的程式碼範例

Function inject_check($sql_str) { return eregi('select|insert|and|or|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile', $sql_str);}if (inject_check($_SERVER['QUERY_STRING'])==1 or inject_check(file_get_contents("php://input"))==1){ /

php 發送帶附件郵件的類

/*** 發送帶附件的郵件* by bbs.it-home.org*/class CMailFile { var $subject; var $addr_to; var $text_body; var $text_encoded; var $mime_headers; var $mime_boundary = "--==================_846811060==_"; var

php實現的css更新類

/** css 更新類,更新css檔案內圖片的版本 * Date: 2013-02-05 * Author: fdipzone * Ver: 1.1 * Edit: bbs.it-home.org* Func: * update(); * * Ver: 1.1 增加search_child參數,可遍曆子檔案夾 */ class CSSUpdate{ private $csstmpl_path = null; private

php產生excel中的列序號

/*** 用php代碼產生excel或csv檔案中的序號*/public function loop(){ $loop = 0; $charnum = 65; for(; $loop $quotient = intval($loop / 26); $remainder = $loop % 26; $f = $quotient>0? chr($charnum+$quotient-1) : ''; $s = $remainder>=0?

PHP強制更新圖片緩衝的範例程式碼

/** 強制更新圖片緩存 * @param Array $files 待更新的圖片 * @param int $version 版本* @edit bbs.it-home.org*/ function force_reload_file($files=array(), $version=0){ $html = ''; if(!isset($_COOKIE['force_reload_page_'.$version])){ // 判斷是否已更新過

php XML檔案解析類(附示範代碼)

/** XML 檔案分析類 * Date: 2013-02-01 * Author: fdipzone * Ver: 1.0 * Edition bbs.it-home.org* func: * loadXmlFile($xmlfile) 讀入xml檔案輸出Array * loadXmlString($xmlstring) 讀入xmlstring 輸出Array */ class XMLParser{ /** 讀取xml檔案 *

總頁數: 5203 1 .... 2453 2454 2455 2456 2457 .... 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.