ezSQL PHP數據庫操作類庫
ezSQL 下載地址: 下載 : ezSQL
新版本是2.05添加了很多支持,包括 CodeIgniter,MSSQL, PDO 等等 我之前也為 CodeIgniter 寫過一次,不過只支持 MySQL
看看使用示例其實也沒什么難度,直接看源代碼即可,主要是程序設計的...
|
ezSQL 下載地址: 下載 : ezSQL
新版本是2.05添加了很多支持,包括 CodeIgniter,MSSQL, PDO 等等 我之前也為 CodeIgniter 寫過一次,不過只支持 MySQL
看看使用示例其實也沒什么難度,直接看源代碼即可,主要是程序設計的...
說明 array array_flip ( array trans ) array_flip() 返回一個反轉后的 array,例如 trans 中的鍵名變成了值,而 trans 中的值成了鍵名。 注意 trans 中的值需要能夠作為合法的鍵名,例如需要是 integer 或者...
復制代碼 代碼如下: mysql_select_db("hills_database_test",$dbcon); $alterpkadd="alter table hills_testcreatetable add id int(32) not null auto_increment primary key;"; mysql_query($alterpkadd,$dbcon);...
復制代碼 代碼如下: ** * 寫文件 * @param string $file 文件路徑 * @param string $str 寫入內容 * @param char $mode 寫入模式 */ function writeFile($file,$str,$mode='w') { $oldmask = @umask(0); $fp = @fope...
百度查閱了一些資料,再結合自己的一些經驗,采用以下解決辦法: 復制代碼 代碼如下: $idlist=''; for($i=1;$i<=20;$i++){ if($i==1){ $idlist=mt_rand(3,25216); } else{ $idlist=$idlist.','.mt_rand(3,25216); } } $que...
基本的工廠類 復制代碼 代碼如下: class MyObject{ //對象將從工廠返回 } class MyFactory{ public static function factory(){ return new MyObject(): } } $instance=MyFactory::factory(); 使用工廠類解析圖像文...
反射API的插件方法是基于在運行時決定程序的功能來實現的,也就是說,它允許創建可選的接口方法,并在首次使用時檢測到這部分接口方法,只有在插件中存在這部分接口的情況下,它們才會被用到. 假設擁有這樣的接口 復制代碼 代...
一、介紹
UTF-8 是一種在web應用中經常使用的一種 Unicode 字符的編碼方式,使用 UTF-8 的好處在于它是一種變長的編碼方式,對于 ANSII 碼編碼長度為1個字節,這樣的話在傳輸大量 ASCII 字符集的網頁時,可以大量節約網絡...
1.php中用smarty模板生成的html在瀏覽器中頂部有一空行.
2.用firedebug發現 meta和link標記在body標簽里.
本機上wmap運行沒事, 送到遠程服務器上是IASP的服務, 會出現上述bug.
看了下源文件, 文本一樣的. 但保...
操作系統:Windows 7 Ultimate WEB服務器:IIS 6.1(內部版本7600)。 數據庫:MySql5.0.67 PHP版本:5.2.13 我還擔心Win7下可能會不兼容,結果是一點問題都沒有。 一、安裝MySql數據庫 MySql數...
寫入過程 復制代碼 代碼如下: // Get the path of the configuration file $fname = JPATH_CONFIGURATION.DS.'configuration.php'; // clear cache $cache = JFactory::getCache(); $cache->clean(); // Update the...
復制代碼 代碼如下: function makeClickableLinks($text) { $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?&//=]+)', '<a href="/1">/1</a>', $text); $text = eregi_replace('([[:space:]()[{}])(w...
1.不轉意html entities 一個基本的常識:所有不可信任的輸入(特別是用戶從form中提交的數據) ,輸出之前都要轉意。 echo $_GET['usename'] ; 這個例子有可能輸出: <script>/*更改admin密碼的腳本或設置cookie的腳本*/</scri...
復制代碼 代碼如下: /******************** *@file - path to file */ function force_download($file) { if ((isset($file))&&(file_exists($file))) { header("Content-length: ".filesize($file)); header('Conte...
復制代碼 代碼如下: /********************** *@filename - path to the image *@tmpname - temporary path to thumbnail *@xmax - max width *@ymax - max height */ function resize_image($filename, $tmpname, $...
復制代碼 代碼如下: if (!preg_match("/^(http|ftp):/", $_POST['url'])) { $_POST['url'] = 'http://'.$_POST['url']; } 該代碼先用正則表達式檢查字符串中是否有"http”或"ftp"和冒號":",如果沒有,在字符串前添加"h...
復制代碼 代碼如下: function getCloud( $data = array(), $minFontSize = 12, $maxFontSize = 30 ) { $minimumCount = min( array_values( $data ) ); $maximumCount = max( array_values( $data ) ); $spread = $m...
復制代碼 代碼如下: /********************** *@file - path to zip file *@destination - destination directory for unzipped files */ function unzip_file($file, $destination){ // create object $zip = new Z...
復制代碼 代碼如下: /* creates a compressed zip file */ function create_zip($files = array(),$destination = '',$overwrite = false) { //if the zip file already exists and overwrite is false, return fals...
復制代碼 代碼如下:function create_slug($string){ $slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $string); return $slug; }...
PHP 提供了一個極少使用的 similar_text 函數,但此函數非常有用,用于比較兩個字符串并返回相似程度的百分比,以下是similar_text () 函數的使用方法: 復制代碼 代碼如下: similar_text($string1, $string2, $percent); //...
使用此代碼可以順利解析人人連接網站POST獲取的數據。 復制代碼 代碼如下: $json_string='{"id":1,"name":"jb51","email":"admin@jb51.net","interest":["wordpress","php"]} '; $obj=json_decode($json_string)...
復制代碼 代碼如下: //xml string $xml_string="<?xml version='1.0'?> <users> <user id='398'> <name>Foo</name> <email>foo@bar.com</name> </user> <user id='867'> <name>Foob...
復制代碼 代碼如下: function list_files($dir) { if(is_dir($dir)) { if($handle = opendir($dir)) { while(($file = readdir($handle)) !== false) { if($file != "." && $file != ".." && $file != "Thumbs.db")...
復制代碼 代碼如下: /***** *@dir - Directory to destroy *@virtual[optional]- whether a virtual directory */ function destroyDir($dir, $virtual = false) { $ds = DIRECTORY_SEPARATOR; $dir = $virtual ? re...