Time of Update: 2016-07-25
unction ubb2html($content){global $article;//是否自動識別if ($article['isparseurl'] == "1"){$content = parseurl($content);}//自動識別結束$content = eregi_replace(quotemeta("[b]"),quotemeta(""),$content);$content =
Time of Update: 2016-07-25
取得隨機字串 /*作用:取得隨機字串參數:1、(int)$length = 32 #隨機字元長度,預設為322、(int)$mode = 0 #隨機字元類型,0為大小寫英文和數字,1為數字,2為小寫子木,3為大寫字母,4為大小寫字母,5為大寫字母和數字,6為小寫字母和數字返回:取得的字串使用:$code = new activeCodeObj;$str = $code->
Time of Update: 2016-07-25
$xml_data =''.''.'1234567890'.'lgsoftwares'.'mypassword'.'phpmind.com'.''.''.''.''.''.''.'JHM'.'OGGSHE'.'101009'.'101509'.'1'.''.'';$URL = "https://www.abc.com/path/";$ch = curl_init($URL);curl_setopt($ch, CURLOPT_MUTE, 1);curl_setopt($ch,
Time of Update: 2016-07-25
package ims.common.util; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import
Time of Update: 2016-07-25
/*功能實用的php分頁類subpages*/class SubPages{ private $each_disNums;//每頁顯示的條目數 private $nums;//總條目數 private $current_page;//當前被選中的頁 private $sub_pages;//每次顯示的頁數 private $pageNums;//總頁數 private $page_array = array();//用來構造分頁的數組 private $subPage_link;/
Time of Update: 2016-07-25
require_once('pclzip.lib.php');$zip = new PclZip("archive.zip");$v_list = $zip->create($_SERVER['DOCUMENT_ROOT'] ,PCLZIP_OPT_REMOVE_PATH,$_SERVER['DOCUMENT_ROOT']);if($v_list == 0){ echo '異常:'.$z->errorInfo(true); }else { echo '備份成功'; }?>複製代碼其它用法舉例:
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
這個函數是我自己寫的,技術不是很好所以有不適當的地方請多多指教 function modifyUri($param = '', $value = '') { 2 //擷取當前頁面URI 3 $uri = $_SERVER['REQUEST_URI']; 4 $uri = (parse_url($uri)); 5
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
這是用開源項目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
看到有人分享了類似這樣的代碼。分享個支援任意大數,而且相當簡單的一段代碼。 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
// 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
php小數轉換百分數的函數,感興趣的朋友可以參考下。樣本1:樣本2:如果有小說位元有要求可以用 sprinphp小數轉換百分數的函數,感興趣的朋友可以參考下。樣本1:樣本2:如果有小說位元有要求可以用 sprintf(".2f", $n*100).'%';樣本3:先 四捨五入,後轉換$str=round(5.055, 2); // 5.06$str1=$str."%"; //5.06%#-------------------------sprintf(".2f", $n*100).'%'
Time of Update: 2016-07-25
/*** by bbs.it-home.org* 2012-12-26*/class Mysql{//該屬性用來儲存執行個體private static $conn;//建構函式為private,防止建立對象private function __construct(){$this->conn = mysql_connect('localhost','root','');}//建立一個用來執行個體化對象的方法public static function
Time of Update: 2016-07-25
error_reporting(E_ALL&~E_NOTICE) ; // 除了E_NOTICE其他異常都會被觸發(E_ALL&~E_NOTICE的二進位運算結果是:E_NOTICE對應位的值被設定為0)try-catch 無法在類的自動載入函數 __autoload() 內生效。try-catch 無法用於捕獲異常,無法捕獲錯誤,例如 trigger_error() 觸發的錯誤,異常和錯誤是不一樣的。try{// you codes that maybe cause an
Time of Update: 2016-07-25
HTML表格的每行轉為CSV格式數組 //HTML表格的每行轉為CSV格式數組 function get_tr_array($table) {//PHP開原始碼$table = preg_replace("']*?>'si",'"',$table); $table = str_replace("",'",',$table); $table = str_replace("