Time of Update: 2016-07-25
// This defines the header typeheader("Content-type: text/css"); // Start the output bufferob_start("compress_css"); // Function which actually compress// The CSS filefunction compress_css($buffer){ /* remove comments */ $buffer = preg_replace("!/\*[
Time of Update: 2016-07-25
echo "\r\n第一種情況\r\n";$a=array(1,2,3,4,5,6);$b=array(7,8,9); $c=array_merge ($a,$b);print_r($c);$c=$a+$b;print_r($c);$c=$b+$a;print_r($c);echo "\r\n第二種情況\r\n";$a=array('a','b','c','d','e','f');$b=array('a','x','y'); $c=array_merge ($a,$b);print_r($c);
Time of Update: 2016-07-25
# 只允許來自don.com的訪問,圖片可能就放置在don.com網站的頁面上setenvifnocase referer "^http://www.don.com/" local_ref# 直接通過地址訪問setenvif referer "^$" local_ref 複製代碼然後,再規定被標記了的訪問才被允許: order allow,denyallow from env=local_ref或者 order deny,allow deny from all allow from
Time of Update: 2016-07-25
class Foo{ private $name = 'hdj'; public function getName(){ return $this->name; }} class Bar extends Foo{ public $name = 'deeka';} $bar = new
Time of Update: 2016-07-25
//php漢字轉碼class qswhU{ var $qswhData; function qswhU($filename="qswhU.php"){ $this->qswhData=file($filename); } function decode($str,$pattern=0){ $arr=array("/(/w+);/iU","/((%/w/w)+)/i","/%u(/w{4,5})/iU"); if(is_integer($pattern)){
Time of Update: 2016-07-25
function Pinyin($_String, $_Code='gb2312') { $_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha".
Time of Update: 2016-07-25
本文介紹了php字串整理的方法,包括訪問單個字元、刪除空白字元、html轉義等操作,有需要的朋友參考下。php實現字串中字元的訪問、整理字串以及字串的轉碼。1,訪問單個字元在php中,可以把字串當成一個字元的數組,可以直接用數組的存取方法來訪問字串。如$str[0]。在這裡要注意的是,如果字元是ascii碼以外時,訪問會有問題。因為這種訪問只能取得一個位元組。2,刪除空白字元在php中,可以用trim(), ltrim(), rtrim()三個函數來刪除字串開頭或結尾的空白字元。其中,trim(
Time of Update: 2016-07-25
static function convert($size) { $unit=array('b','kb','mb','gb','tb','pb'); return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; }複製代碼2,php擷取檔案大小的方法二 /** * Returns a human readable filesize */function
Time of Update: 2016-07-25
$db_name="test"; $db_username="root"; global $db_password; ?>複製代碼2,資料庫操作類(調用設定檔)db.fun.php: require("config/config.php"); class db{ function fun(){ global $db_username,$db_password; echo "資料庫使用者名稱:".$db_username.""; echo "資料庫密碼:".$db_password.""; }
Time of Update: 2016-07-25
/* * 來源: http://www.xuehuwang.com/ * 作者: 雪狐部落格 * 應用: 用於處理配置資料* 搜集整理:bbs.it-home.org**/ final class Config { private $data = array(); public function get($key) { return (isset($this->data[$key]) ?
Time of Update: 2016-07-25
rpm -ivh http://nginx.org/packages/centos/6/noarch/rpms/nginx-release-centos-6-0.el6.ngx.noarch.rpm複製代碼安裝epel源: (64位系統) rpm -ivh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm(32位系統) rpm -ivh
Time of Update: 2016-07-25
/** * 長文章分段 * @param string $article 文章內容 * @param number $return_number 文章位元組限制 * @return array */ private function ContentAddpage($content,$return_number=800){ $return_content = ""; //返回的字串 $current_num = 0; //當前字串長度
Time of Update: 2016-07-25
class A { public function __toString() { return 'bar'; }}$a = new A();define('foo', $a);echo foo;// 輸出bar複製代碼php中的define究竟是如何?的: ZEND_FUNCTION(define){ char *name; int name_len; zval *val; zval *val_free = NULL; zend_bool
Time of Update: 2016-07-25
#listen 12.34.56.78:80listen 8080複製代碼2,載入模型: loadmodule php5_module "d:myziliaophpphp54php5apache2_2.dll"複製代碼3,支援的類型: addtype application/x-compress .zaddtype application/x-gzip .gz .tgzaddtype application/x-httpd-php .phpphpinidir "d:myziliaophpphp5
Time of Update: 2016-07-25
header("content-type: text/html; charset=utf-8"); echo mb_convert_encoding("妳係我的友仔", "utf-8", "gbk"); ?>複製代碼2,gb2312 to big5 編碼轉換 header("content-type: text/html; charset=big5"); echo mb_convert_encoding("你是我的朋友", "big5", "gb2312"); ?>
Time of Update: 2016-07-25
$Article = M('Article');$Article->limit('0,10')->select(); // 查詢第一頁資料$Article->limit('10,10')->select(); // 查詢第二頁資料複製代碼雖然利用擴充類庫中的分頁類Page可以自動計算出每個分頁的limit參數,但是如果要自己寫就比較費力了,如果用page方法來寫則簡單多了,例如: $Article = M('Article');$Article->page('1,10')->select();
Time of Update: 2016-07-25
function write_cookie($cookie,$db){$fp = fopen(‘/tmp/cookie.txt’, ‘w’);fwrite($fp, $cookie);fclose($fp);}function get_cookie($db){$handle = @fopen(“/tmp/cookie.txt”, “r”);if ($handle) {while (($buffer = fgets($handle, 4096)) !== false) {$cookie =
Time of Update: 2016-07-25
/** * $str 原始字串 * $encoding 原始字串的編碼,預設GBK * $prefix 編碼後的首碼,預設"" * $postfix 編碼後的尾碼,預設";" */function unicode_encode($str, $encoding = 'GBK', $prefix = '', $postfix = ';') { $str = iconv($encoding, 'UCS-2', $str); $arrstr = str_split($str, 2);
Time of Update: 2016-07-25
jQuery.extend({ createUploadIframe: function(id, uri) { //create frame var frameId = 'jUploadFrame' + id; var iframeHtml = ' 複製代碼index.js檔案: $(function(){ $("#upload_file").change(function(){ $("#uploadFrom").submit(); }
Time of Update: 2016-07-25
/* 檢查原始檔案是否存在及獲得原始檔案的資訊 */ $org_info = @getimagesize($img); $img_org = $this->img_resource($img, $org_info[2]); /* 原始圖片以及縮圖的尺寸比例 */ $scale_org = $org_info[0] / $org_info[1]; /* 處理只有縮圖寬和高有一個為0的情況,這時背景和縮圖一樣大 */ if ($thumb_width =