Time of Update: 2016-07-13
問題解決1.安裝apt-get install php5-mcrypt2.編輯php設定檔vim /etc/php5/cgi/php.ini找到mcrypt並在下面添加紅色行:[mcrypt]; For more information about mcrypt settings see http://php.net/mcrypt-module-open; Directory where to load mcrypt algorithms; Default: Compiled in into
Time of Update: 2016-07-13
PHP分頁函數備份,日期2011-09-25,修正了幾個問題。(1)當總頁數為0時候多出計算的問題。(2)噹噹前頁為尾頁時候,計算錯誤的問題。(3)當總頁數小與浮動頁數時候的問題。 view plain//新的分頁函數 function fenye($fenyeurl,$page,$totalnum,$perpage,$rewrite=0){ $page = max($page,1); $totalpage = ceil($totalnum/$perpage);
Time of Update: 2016-07-13
設定檔現在需要一個短語密碼$cfg['blowfish_secret'] = ‘malu’;將phpmyadmin/libraries/config.default.php 中的$cfg['blowfish_secret'] = ”; 改成 $cfg['blowfish_secret'] = ‘malu’;
Time of Update: 2016-07-13
HTMLAjax傳值 尋找的結果為: //樣本數組 搜尋 depth$src_array = array( 'test' => '123', array( 'has' => 'OK', 'find'=> true, array( 'depth' =>
Time of Update: 2016-07-13
需要工具:(1) apache tomcat(2) Quercus Quercus在web-inf/lib/下的jar包,放到$TOMCAT_HOME/lib下面,修改$TOMCAT_HOME/conf/web.xml檔案,加入如下 servlet映射:Xml代碼 Quercus Servlet com.caucho.quercus.servlet.QuercusServlet database jdbc/test --> ini-file WEB-INF/php.ini -->
Time of Update: 2016-07-13
一、頁面編碼 1. 使用 標籤設定頁面編碼 這個標籤的作用是聲明用戶端的瀏覽器用什麼字元集編碼顯示該頁面,xxx可以為GB2312,GBK,UTF-8(和MySQL不同,MySQL是
Time of Update: 2016-07-13
在PHP中,is_file和file_isexist是有很小區別的 1) is_file: $path ="/path/to/file/text.txt"; if(file_exists($path)) echo "File Exists"; else echo "File not Exists"; 比如在這個例子中,檔案存在會返回true,不存在返回false,但注意的是,假如傳入一個 正確的路徑(比如一個檔案目錄),也會返回true: $path
Time of Update: 2016-07-13
Php錯誤的類別,主要有以下三大類:1. 語法錯誤程式這種情況通常在執行的時候,會顯示錯誤資訊(報錯)。這種類型錯誤會阻止頁面php指令碼執行其他任務。如:Echo 100.Echo 100;Echo 101;?>執行結果 Parse error: syntax error, unexpected ';' in… 2. 執行階段錯誤不會阻止php指令碼的運行,但是會阻止該指令碼做本身希望做的事情。如下:echo “this
Time of Update: 2016-07-13
詳細代碼如下 Php代碼 //下面定義一個發送郵件的函數,已經測試通過。 //$sendto_email:郵件發送地址 //$subject:郵件主題 //$body:郵件內文內容 //$sendto_name郵件接受方的姓名,發送方起的名字。一般可省。 function stmp_mail($sendto_email, $subject = null, $body = null, $sendto_name = null) { vendor (
Time of Update: 2016-07-13
很多時候我們需要將幾個字串串連起來顯示,在PHP中,字串之間使用“點”來串連,也就是英文中的句號”.”,具體使用方式如下: //定義字串 $str1 = "Hello World!"; $str2 = "Welcome to HutaoW's BLOG!"; //串連上面兩個字串 中間用空格分隔 $str3 = $str1 . " " . $str2; //輸出串連後的字串 echo $str3; /*
Time of Update: 2016-07-13
數組 1.概述 數組提供了一種快速,方便地管理一組相關資料的方法,是php程式設計中的重要內容。通過數組可以對大量性質相同的資料進行儲存,排序,插入及刪除等操作,從而可以有效地提高程式開發效率及改善程式的編寫方式。 數組是一組資料的集合,將資料按照一定規則群組織起來,形成一個可操作的整體,是對大量資料進行有效組織和管理的手段之一,通過數組函數可以對大量性質相同的資料進行儲存,排序,插入及刪除等操作,從而可以有效地提高程式開發效率及改善程式的編寫方式。 2.數群組類型
Time of Update: 2016-07-13
符翻轉對於php處理來說,簡直是小菜一碟,php的字串函數strrev就可以處理例如: echo strrev("Hello World!"); //輸出結果為"!dlroW olleH"但有時候面試的時候往往需要我們自己來寫個函數來實現跟strrev同樣的效果,其實這也不難,例如: /** * 實現字串翻轉的函數 * @param string $str 要處理的字串 * @return string 翻轉成功的字串 */function reverse($str){
Time of Update: 2016-07-13
cannot find -lltdl ,編譯php又出錯了php在make過程中出現“usr bin ld cannot find lltdl”錯誤,詳細錯誤如下:/usr/bin/ld: cannot find -lltdlcollect2: ld returned 1 exit statusmake: *** [libphp5.la] Error
Time of Update: 2016-07-13
思路用fopen函數和fread函數得到模板,然後用str_replace函數替換模板標籤為變數,最後用fwrite函數輸出新的HTML頁面index.html模板頁面 {title} 文章內容為:{content} index.php
Time of Update: 2016-07-13
//設定PHPExcel類庫的include path set_include_path('.'. PATH_SEPARATOR . 'D:\Zeal\PHP_LIBS' . PATH_SEPARATOR . get_include_path()); /** www.2cto.com* 以下是使用樣本,對於以 //// 開頭的行是不同的可選方式,請根據實際需要 * 開啟對應行的注釋。 * 如果使用 Excel5 ,輸出的內容應該是GBK編碼。
Time of Update: 2016-07-13
今天在學習Yii Framework中單元測試時,總是在運行“phpunit unit/DBTest.php”命令的時候出現以下錯誤,PHP Notice: Please no longer include "PHPUnit/Framework.php". in /usr/share/php/PHPUnit/Framework.php on line
Time of Update: 2016-07-13
1.下載官方有例子的包,然後找到例子下面的Page例子。2. 找到Page.class.php,複製到你自己的項目ThinkPHP/Lib/Think/Util下面。3.Php代碼 public function doPage(){ //echo $_GET["p"]; if(emptyempty($_GET["p"])) $this->assign('p', 1); else
Time of Update: 2016-07-13
用php4中帶的array_pop這個函數即可,函數原型:mixed array_pop(array array)舉個例子:$array = array(php,jsp,asp);$count = count($array);echo old:;for($i=0;$i;array_pop($array);$count = count($array);echo new:;for($i=0;$i;?>輸出結果:old:phpjspaspnew:phpjspphp
Time of Update: 2016-07-13
關於PHP編程技術的相關知識,我們已經瞭解了很多,建議大家閱讀下這篇文章,《PHP經驗分享:常用的小技巧》,供大家參考。下面介紹的是提高PHP編程技術的幾種方法。1、PHP標籤我知道有些人寫PHP代碼的時候喜歡用縮減標籤,但是這可不是個好習慣,因為縮減標籤在有些伺服器上不能被正確識別,而標準的PHP標籤的使用使你可以在任何一台伺服器上準確編譯你的PHP代碼。
Time of Update: 2016-07-13
02SimCalendar('2011-08');03function SimCalendar($date)04{05 /**06 * 簡單日曆輸出,本函數需要cal_days_in_month的支援07 * @param $date Y-m 要輸出的日期08 */09 echo '10 11 12 日13 一14 二15 三16