Time of Update: 2016-07-25
非遞迴的深度優先的演算法,用了一個棧來實現 define('DS', DIRECTORY_SEPARATOR);function deep_first_list_files($from = '.'){ if(!is_dir($from)) { return false; } $files = array(); $dirs =
Time of Update: 2016-07-25
在Zend Framework中設定資料庫參數 我是用zend studio 7.2.1建立的zend framework project也就是說我的架構是由zend stduio7.2.1 幫我建立了檔案路徑等資訊的下面講講如何在建立好的zend framework
Time of Update: 2016-07-25
很簡單的一段, 沒啥好說的.. /** * 容量格式化 * * @param Int $filesize * @return
Time of Update: 2016-07-25
這個函數是我自己寫的,技術不是很好所以有不適當的地方請多多指教 function modifyUri($param = '', $value = '') { 2 //擷取當前頁面URI 3 $uri = $_SERVER['REQUEST_URI']; 4 $uri = (parse_url($uri)); 5
Time of Update: 2016-07-25
遞迴的深度優先的演算法 define('DS', DIRECTORY_SEPARATOR);function rec_list_files($from = '.'){ if(!is_dir($from)) { return array(); } $files = array(); if($dh = opendir($from))
Time of Update: 2016-07-25
經過了一些修改與完善的效果 $array1 = array("a" => "green", "red", "blue", "red"); $array2 = array("b" => "green"); $result = array_diff($array1, $array2);//這樣就相當於刪除$array1裡的值為"green"的元素。
Time of Update: 2016-07-25
函數解析 /** * @desc 轉換成位元組數 * 注意它case的用法,由於沒有寫break;所以可以實現一個優雅的換算公式 * 但是 如果順序換了就完蛋了 * @author wangjiafang * @since 2010.12.22 * @param string * @return string */function
Time of Update: 2016-07-25
這是用開源項目PHPMailer實現郵件發送 ,先下載檔案,我這裡下載得是5.1得版本,然後把三個class.***.php檔案放到專案檔下,我首先用得是gmail,但是失敗了,問題是認證失敗,後來用了QQ郵箱,發送成功。 require("class.phpmailer.php"); //下載的檔案必須放在該檔案所在目錄$mail = new PHPMailer();
Time of Update: 2016-07-25
自訂的PHP字串截取函數 function get_substr($string,$start='0',$length=''){ $start = (int)$start; $length = (int)$length; $i = 0; if(!$string) { return; } if($start>=0) {
Time of Update: 2016-07-25
用phpRegex來記取資料 xml源檔案 張映 男 28 tank 男 28 $xml = ""; $f = fopen('person.xml', 'r'); while( $data = fread( $f, 4096 ) ) { $xml .= $data; } fclose( $f ); // 上面讀取資料
Time of Update: 2016-07-25
看到有人分享了類似這樣的代碼。分享個支援任意大數,而且相當簡單的一段代碼。 function formatFileSize($fileSize){$unit = array(' Bytes', ' KB', ' MB', ' GB', ' TB', ' PB', ' EB', ' ZB', ' YB');$i = 0;/*while($fileSize >= 1024 &
Time of Update: 2016-07-25
XML(Extensible Markup Language)即可擴充標記語言,它與HTML一樣,都是SGML(Standard Generalized Markup Language,標準通用標記語言 (SGML))。 xml源檔案 張映 男 28 tank 男 28 $doc = new DOMDocument();
Time of Update: 2016-07-25
.PHP產生靜態html檔案的方法 1,下面使用模版的一個方法! $fp = fopen ("templets.html","a"); if ($fp){ $fup = fread ($fp,filesize("templets.html")); $fp2 = fopen ("html.shtml","w"); if ($fwrite ($fp2,$fup)){
Time of Update: 2016-07-25
// start at the top of the page since we start a sessionsession_name('mysite_hit_counter');session_start();//$fn = 'hits_counter.txt';$hits = 0;// read current hitsif (($hits = file_get_contents($fn)) === false){$hits = 0;}// write one more hitif
Time of Update: 2016-07-25
usage : copy code above into encoder.php place this file into your web server root directory, install all the requried tools needed to use ffmpeg-php now place some video.avi and video.srt or video.sub etc video.idx subtitle ,to encode video with
Time of Update: 2016-07-25
// Encrypt Functionfunction mc_encrypt($encrypt, $mc_key) {$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);$passcrypt = trim(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $mc_key, trim($encrypt), MCRYPT_MODE_ECB, $
Time of Update: 2016-07-25
Kohana的視圖層很簡單,變數資料放在$_data數組中。所以繼承Kohana_View類並覆寫部分方法,就可以非常輕鬆的使用第三方模版引擎作為視圖層。 這裡的例子是使用Blitz Template,如果要用Smarty之類的也可以類似修改。 檔案在application/classes/stucampus/system/view.php下,可以修改,但是修改要和命名空間對應。至於如何支援命名空間,見這裡
Time of Update: 2016-07-25
class DataBase{ var $pConnect=FALSE;//是否使用長串連 var $mHost;//資料庫主機 var $mDatabase; var $db; //資料庫 var $mUser;//資料庫使用者名稱 var $mPwd;//資料庫使用者密碼 var $mConn;//串連標識 var $result;// 執行query命令的結果資源標識 var $num_rows;// 返回的條目數 var $insert_id;//
Time of Update: 2016-07-25
如果已經安裝了lynx和php5-cli,那麼就可以很方便的安裝pear包了。如果安裝了lynx和php5-cli,直接運行 # lynx -source http://pear.php.net/go-pear | php 就可以出現安裝如果已經安裝了lynx和php5-cli,那麼就可以很方便的安裝pear包了。如果安裝了lynx和php5-cli,直接運行 # lynx -source http://pear.php.net/go-pear | php
Time of Update: 2016-07-25
本文為大家介紹php的fwrite函數的用法,供大家參考。PHP fwrite()fwrite() 函數用於向檔案寫入字串,成功返回寫入的字元數,否則返回 FALSE 。文法:int fwrite( res本文為大家介紹php的fwrite函數的用法,供大家參考。PHP fwrite()fwrite() 函數用於向檔案寫入字串,成功返回寫入的字元數,否則返回 FALSE 。文法:int fwrite( resource handle, string string [, int length] )