Time of Update: 2016-07-25
ini_set(‘pcre.backtrack_limit’, 999999999); 複製代碼注意:此參數在php 5.2.0版本之後可用。關於:pcre.recursion_limitpcre.recursion_limit是pcre的遞迴限制,這個項如果設很大的值,會消耗所有進程的可用堆棧,最後導致php崩潰。也可以通過修改配置來限制:ini_set(‘pcre.recursion_limit’, 99999);複製代碼最好對記憶體進行限定設定:ini_set(‘memory_limit’
Time of Update: 2016-07-25
/* * curl_multi 經測試,大於四個網址時要比Foreach迴圈快.. * by wc1217 * edit:bbs.it-home.org */ class curl_multi{ //Curl控制代碼 //private $curl_handle = null; //網址 private $url_list = array(); //參數 private $curl_setopt = array( '
Time of Update: 2016-07-25
function validation_filter_id_card($id_card){ if(strlen($id_card)==18){ return idcard_checksum18($id_card); }elseif((strlen($id_card)==15)){ $id_card=idcard_15to18($id_card); return idcard_checksum18($id_card); }else{ return false; }}// 計算身份證校正碼,
Time of Update: 2016-07-25
function http_open($url, $data, $cookie = null, $method = "GET", $timeout = 60) { $options = array(); $options['http']['method'] = $method; $options['http']['user_agent'] = $_SERVER['HTTP_USER_AGENT']; $options['http']['timeout'] = $timeout;
Time of Update: 2016-07-25
function DJBHash($str) // 0.22{$hash = 0;$n = strlen($str);for ($i = 0; $i {$hash += ($hash }return $hash % 701819;} function ELFHash($str) // 0.35{$hash = $x = 0;$n = strlen($str); for ($i = 0; $i {$hash = ($hash if(($x = $hash & 0xf0000000) != 0){$
Time of Update: 2016-07-25
//php漢字轉碼class qswhBig5{ var $qswhData; function qswhBig5($filename="qswhBig5.php"){ $this->qswhData=file($filename); } function qswhStr($gb,$fail="??"){ /******(qiushuiwuhen 2002-9-6)******/ $ret=""; for($i=0;$i if(($p=ord(substr($gb,$i,1)))>1
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使用gd庫繪圖時,無法顯示圖片的原因與解決方案,有需要的朋友參考下。php繪圖,必需確認gd庫是否啟用,到php.ini檔案中,找到extension=php_gd2.dll將前面的;去掉,重新啟動伺服器。如果在繪圖中還是沒有顯示正常的圖片,說明伺服器在回複請求時,圖片的資訊有誤,要保證不要前面不要有任何東西,包括html。若還不出圖片,在繪圖前清一下緩衝(也就是在寫header之前),先寫ob_clean();
Time of Update: 2016-07-25
介紹下修改php上傳檔案大小限制的方法,php中預設的檔案上傳大小為2M,這裡分享下具體的修改方法,有需要的朋友參考下。1,php中預設的該頁最久執行時間為 30 秒.就是說超過30秒,該指令碼就停止執行.這就導致出現 無法開啟網頁的情況.這時我們可以修改 max_execution_time在php.ini裡尋找max_execution_time預設是30秒.改為max_execution_time = 00表示沒有限制2,修改 post_max_size 設定 POST
Time of Update: 2016-07-25
/** 返迴文件從X行到Y行的內容(支援php5、php4) * @param string $filename 檔案名稱 * @param int $startLine 開始的行數 * @param int $endLine 結束的行數 * @return string */function getFileLines($filename, $startLine = 1, $endLine=50, $method='rb') { $content = array();
Time of Update: 2016-07-25
$filename="./files.text"; $fp=fopen($finename,"rb"); $encho fread($fp,100); ?>複製代碼readfile(),file()和file_get_contents()函數. readfile(),file()和file_get_contents()函數. int readfile(string filename[,bool use_include_path,resource
Time of Update: 2016-07-25
file_uploads = On ;開啟檔案上傳選項 upload_max_filesize = 500M ;上傳檔案上限複製代碼如果要上傳比較大的檔案,僅僅以上兩條還不夠,還需要把伺服器緩衝上限調大,把指令碼最大執行時間變長。如下: post_max_size = 500M ;post上限 max_execution_time = 1800 ; Maximum execution time of each script, in seconds指令碼最大執行時間 max_input_time
Time of Update: 2016-07-25
$file_name = urlencode($_REQUEST['filename']); header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header('Content-Type: application/
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
#如果提示The requested URL returned error: 404,請自行換成最新的版本 rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm rpm -ivh http://download.Fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm複製代碼步驟 2.
Time of Update: 2016-07-25
#yum -y install mysql mysql-server mysql-devel複製代碼配置mysql開機啟動服務 #chkconfig --add mysqld (在服務資訊清單中添加mysql服務) #chkconfig mysqld on (設定mysql服務隨開機啟動) #service mysqld start (啟動mysql服務)複製代碼二、安裝PHP #yum -y install php #service httpd restart (重啟apache)
Time of Update: 2016-07-25
本文介紹了php中日期與時間函數的具體用法,感興趣的朋友參考下。主要介紹date、getdate、mktime、checkdate等日期與時間函數的用法。 (1)date用法:date(格式,[時間]);如果沒有時間參數,則使用目前時間.格式是一個字串,其中以下字元有特殊意義:U 替換成從一個起始時間(好象是1970年1月1日)以來的秒數Y 替換成4位的年號.y 替換成2位的年號.F 替換成月份的英文全稱.M 替換成月份的英文簡稱.m 替換成月份數.z 替換成從當年1月1日以來的天數.d
Time of Update: 2016-07-25
//透明背景圖片header(‘content-type:text/html;charset=gbk’);$safess = $_get[safe];$dir = dirname(__file__).”/simsun.ttc”;$safe=iconv(“gb2312″,”utf-8″,$safess); $im=imagecreatetruecolor(160,18); $color=imagecolorallocate($im,229,231,230);
Time of Update: 2016-07-25
本文介紹了php中漢字編碼轉換的一些知識,分析了php編碼轉換的原理與方法,有需要的朋友參考下。有關對mysql4.1字元集的理解,再講述如何php如何適應mysql的這種變化。同樣適用於mysql5及以上的版本。一.原理篇mysql的字元集裡有兩個概念,一個是“character set(字元集)”,另一個是“collations”。1. collationscollations翻成中文是“校正”,在網頁開發的過程中,這個詞彙,只在mysql裡使用,主要作用是指導mysql對字元的比較,比如,