Time of Update: 2018-12-06
遍曆檔案夾下的所有檔案和子檔案夾: <?phpfunction my_dir($dir){ $files =array(); if($hand = opendir($dir)){ while(($file = readdir($hand)) != false){ if($file != ".." && $file != '.'){ if(is_dir($dir ."/" .$file)){
Time of Update: 2018-12-06
適配器設計模式只是將某個對象的介面適配為另一個對象所期望的介面。適配器設計模式的目標是有助於物件導向的代碼,該模式可以為對象介面建立回話。通過執行個體說明: 1 /* 2 在項目最初的程式碼程式庫中,名為errorObject的對象能夠處理所有錯誤的訊息和代碼。直接將訊息輸入至控制台: 3 */ 4 5 class errorObject{ 6 private $__error; 7 8 pubic function __construct($error){ 9
Time of Update: 2018-12-06
p { margin-bottom: 0.08in; }flash與asp:先把兩個代碼貼一下:flash: 網頁教學網 var loader:URLLoader = new URLLoader(); var url:URLRequest = newURLRequest("test.asp"); url.method = URLRequestMethod.POST; var values:URLVariables =
Time of Update: 2018-12-06
這篇文章之前發表在我的CSDN的部落格中,現在貼到部落格園來。。。由於目前學習工作的不同,導致要用很多的語言進行工作和開發,因此經常弄混各個之間的差別。今天有空,就將其做了出來,如下表,希望可以大家的工作和學習有所協助!如果有什麼不嚴謹的地方,歡迎提出!說明C(區分大小寫)Delphi(不區分大小寫)PHP(區分大小寫)整型變數的定義char a = 'a'; /* 8位有符號*/int a=10; /* 16位有符號*/unsigned int a =
Time of Update: 2018-12-06
最近在做網站的遷移的時候出現了一些問題,花了好多時間來解決,寫寫記錄下。1.short_open_tagphp的代碼一般在php檔案中是包含下面這樣子的標籤內的<?php..........?>但是我改的這個網站它在一些使用了沒有php而是簡單的標籤,叫做short_open_tag<? ...
Time of Update: 2018-12-06
session的工作原理 一、術語session 在我的經驗裡,session這個詞被濫用的程度大概僅次於transaction,更加有趣的是transaction與session在某些語境下的含義是相同的。
Time of Update: 2018-12-06
<?php//===============================時間日期===============================//y返回年最後兩位,Y年四位元,m月份數字,M月份英文。d月份幾號數字,D星期幾英文$date=date("Y-m-d");$date=date("Y-m-d H:i:s");//帶時分秒//include,include_once.require,require_once//require("file.php")
Time of Update: 2018-12-06
<?php//===========================================================cookie//$cookieValue = 'cookieValue';//兩種方法可以建立cookie//1,//setcookie("cookieName", $cookieValue, time()+600,"/t12/f1/f11/");//2,//header("Set-Cookie:cookieName=$cookieValue;expire="
Time of Update: 2018-12-06
<?php$file = "./test/f1.php";//===============判斷檔案能不能讀取(許可權問題),或者存不存在if (is_readable($file) == false) { echo "<br/>"; die('no');}//===============判斷檔案存不存在if (file_exists($file) == false) { echo "<br/>"; die('no file');}//==
Time of Update: 2018-12-06
<?php$fileName = "fileName";header("Content-Type:text/csv;charset=UTF-8"); //'text/csv'是CSV檔案,'application/vnd.ms-excel'是excel檔案header("Content-Disposition: attachment; filename=" . $fileName . ".csv");
Time of Update: 2018-12-06
<?php//資料庫連接$conn = mysql_connect('localhost', 'root', '');mysql_select_db('test', $conn);mysql_query("SET NAMES GBK");/*支援事務的表必須是InnoDB類型一段事務中只能出現一次:mysql_query('START TRANSACTION');//開始事務mysql_query(' ROLLBACK
Time of Update: 2018-12-06
1.從 http://glob.com.au/sendmail/ 下載sendmail.zip2.解壓到 D:\ApacheServer\php\sendmail 最好短路徑,長路徑名有可能產生問題。3.php.ini配置SMTP = smtp.126.comsendmail_from = zdy_521@126.comsendmail_path = "D:\ApacheServer\php\sendmail\sendmail.exe
Time of Update: 2018-12-06
<form id="form1" name="form1" method="post" action=""> <label> <input name="file1" type="file" id="file1" /> <input type="submit" name="Submit1" value="提交" />
Time of Update: 2018-12-06
<?php//做限制判斷上傳的必須是普通圖片類型檔案而且檔案大小必須小於1MB,不同類型檔案$_FILES["file1"]["type"]值不同if ((($_FILES["file1"]["type"] == "image/gif") || ($_FILES["file1"]["type"] == "image/jpeg") || ($_FILES["file1"]["type"] == "image/pjpeg")) &&
Time of Update: 2018-12-06
MySQL資料庫編碼、html頁面編碼、PHP或html檔案本身編碼要全部一致。1、MySQL資料庫編碼:建立資料庫時指定編碼(如gbk_chinese_ci),建立資料表、建立欄位、插入資料時不要指定編碼,會自動繼承資料庫的編碼。資料庫連接時,也有編碼,可以在串連完資料庫後,執行mysql_query('SET NAMES gbk'); 2、html頁面的編碼,指的是這一行的設定:<meta http-equiv="Content-Type" content="text/html;
Time of Update: 2018-12-06
<?php// http://www.jb51.net/article/23093.htmfunction set_cache($name, $value) { // 設定相對或者絕對目錄,末尾不要加 "/" $cache_dir = "./cache"; // 設定副檔名 $cache_extension = ".php"; $cache_str_begin = "<?php\n//Cache Created at: " . date (
Time of Update: 2018-12-06
<?phpclass Chs_to_En { function Pinyin($_String, $_Code = 'GBK') { $_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" . "|chai|chan|chang|chao|che|chen|cheng|chi|
Time of Update: 2018-12-06
<?php//php需要開啟ssl(OpenSSL)支援$apnsCert = "ck.pem";//串連到APNS時的認證許可檔案,認證需格外按要求建立$pass = "123456";//認證口令$serverUrl = "ssl://gateway.sandbox.push.apple.com:2195";//push伺服器,這裡是開發測試伺服器$deviceToken = "a8fcd4aa8943b223d4ebcd54fe168a8b99b3f24c63
Time of Update: 2018-12-06
飯否的圖片外掛程式可用於論壇,部落格,將使用者的資訊和一些最新動向用圖片的形式表現出來。我們如果需要自行開發此功能的話,需要設定某種格式(或某個地址)的圖片採用指令碼來處理。在Perl中的話例如可以使用Apache的LocationMatch或者FilesMatch指令來進行設定,讓某個Perl模組來進行處理。如果使用Mason的話,更為簡單,不需要修改伺服器,只需利用dhandler的特性,就可以讓指定的指令碼來處理。基本流程如下:主要代碼如下: my $uri = $r->uri;
Time of Update: 2018-12-06
很多人寫程式時,用 header(location) 進行跳轉往往不記得寫 exit() 語句,事實上這種做法是存在嚴重風險的。從瀏覽器上看,使用 header(location) 就跳轉到另一個頁面了,但事實上,php卻仍然會執行背景代碼的,假如後面的代碼有不安全邏輯的,那就直接無視開發人員設定的條件,繼續把後面的東西給執行了。如: if(true){