Time of Update: 2016-07-21
1. $_REQUEST php中$_REQUEST可以擷取以POST方法和GET方法提交的資料,但是速度比較慢 2. $_GET 用來擷取由瀏覽器通過GET方法提交的資料。GET方法他是通過把參數資料加在提交表單的action屬性所指的URL中,值和表單內每個欄位一一對應,然後在URL中可以看到,但是有如下缺點: 1. 安全性不好,在URL中可以看得到 2. 傳送資料量較小,不能大於2KB。 3. $_POST 用來擷取由瀏覽器通過POST方法提交的資料。POST方法他是通過HTTP
Time of Update: 2016-07-21
複製代碼 代碼如下: function listFiles($path){ $result = array(); foreach(glob($path.'\\'."*") as $item){ $result[strtolower($item)] = $item; if(is_dir($item)){ $result += listFiles($item); } } return $result; } $path = 'E:\\web\\dianle';
Time of Update: 2016-07-21
:原始碼: [code] //+------------------------+ //| pie3dfun.PHP//公用函數 | //+------------------------+ define("ANGLE_STEP", 5); //定義畫橢圓弧時的角度步長 function draw_getdarkcolor($img,$clr) //求$clr對應的暗色 { $rgb = imagecolorsforindex($img,$clr); return
Time of Update: 2016-07-21
複製代碼 代碼如下: /** * 操縱檔案類 * * 例子: * FileUtil::createDir('a/1/2/3'); 測試建立檔案夾 建一個a/1/2/3檔案夾 * FileUtil::createFile('b/1/2/3'); 測試建立檔案 在b/1/2/檔案夾下面建一個3檔案 * FileUtil::createFile('b/1/2/3.exe'); 測試建立檔案 在b/1/2/檔案夾下面建一個3.exe檔案 * FileUtil::copyDir('b','d/e');
Time of Update: 2016-07-21
php類代碼: 複製代碼 代碼如下: class MQ{ public static $client; private static $m_real; private static $m_front; private static $m_data = array(); const QUEUE_MAX_NUM = 100000000; const QUEUE_FRONT_KEY = '_queue_item_front'; const QUEUE_REAL_KEY =
Time of Update: 2016-07-21
指令碼之家註:理論上下面的方法可以可以的,但前提是保證你的php配置的沒有錯誤,建議大家用新版的php版本,與discuz程式,相關的伺服器相關軟體可以到s.jb51.net下載。這兩天論壇經常報錯誤資訊 Warning: require_once(./include/common.inc.php) [function.require- once]: failed to open stream: No such file or directory in
Time of Update: 2016-07-21
iconv — Convert string to requested character encoding(PHP 4 >= 4.0.5, PHP 5) mb_convert_encoding — Convert character encoding(PHP 4 >= 4.0.6, PHP 5) 用法: string mb_convert_encoding ( string str, string to_encoding [, mixed from_encoding] ) 需要先啟用
Time of Update: 2016-07-21
第一種寫法: $content=str_replace("\n","",$content); echo $content; 第二種寫法: str_replace("\r\n","",$str); 第三種寫法: $content=preg_replace("/\s/","",$content); echo $content; 附: 首先說說\n,\r,\t \n 軟斷行符號: 在Windows 中表示換行且回到下一行的最開始位置 在Linux、unix 中只表示換行,但不會回到下一行的開始位置。
Time of Update: 2016-07-21
SvnPeer.php 複製代碼 代碼如下: /** * * This class for execute the external program of svn * * @auth Seven Yang * */ class SvnPeer { /** * List directory entries in the repository * * @param string a specific project repository path * @return bool true, if
Time of Update: 2016-07-21
複製代碼 代碼如下: $str=''; $pattern="//"; preg_match_all($pattern,$str,$match); print_r($match); ?> 結果顯示: Array ( [0] => Array ( [0] => ) [1] => Array ( [0] => upfiles/2009/07/1246430143_1.jpg )
Time of Update: 2016-07-21
php代碼類: 複製代碼 代碼如下: /** * Copyright (c) 2011 - 01 XatuDream * XatuDream All Rights Reserved. * Support:185390516.qzone.qq.com * QQ:185390516 * Author:Lau Version:1.01 * Date:2010-08-12 09:28:32 */ ! defined ( 'WORKSPACE' ) && exit ( "Access Denied !"
Time of Update: 2016-07-21
在網上找到一種解決方案: 複製代碼 代碼如下: /* 處理json_encode中文亂碼 */ $data = array ('game' => '冰火國度', 'name' => '刺之靈', 'country' => '冰霜國', 'level' => 45 ); echo json_encode ( $data ); echo ""; $newData = array (); foreach ( $data as $key => $value ) { $newData [$key] =
Time of Update: 2016-07-21
複製代碼 代碼如下: /** +---------------------------------------------------------- * UBB 解析 +---------------------------------------------------------- * @return string +---------------------------------------------------------- */ function ubb($Text) {
Time of Update: 2016-07-21
簡單示意一下: 複製代碼 代碼如下: class test { private $_name = ''; public function setName($name) { $this->_name = $name; return $this; } public function getName() { echo $this->_name . "\n"; return $this; } } $link = new test(); // 方法鏈
Time of Update: 2016-07-21
nl2br()定義和用法 nl2br() 函數在字串中的每個新行 (\n) 之前插入 HTML 分行符號 ()。 文法 nl2br(string)參數 描述 string 必需。規定要檢查的字串。 例子 複製代碼 代碼如下: echo nl2br("One line.\nAnother line."); ?> 輸出: One line. Another line.HTML 程式碼: One line. Another line.http://www.bkjia.com/PHPjc/324560
Time of Update: 2016-07-21
複製代碼 代碼如下: public function captcha(){ $font_dir = $_SERVER ["DOCUMENT_ROOT"] . "your_ttf_file.ttf"; // 字型庫 $img_w = 58; // 設定圖片寬 $img_h = 20; // 設定圖片高 $font_size = 11; // 字型大小 $angle_l = -10; // 左偏角 $angle_r = 10; // 右偏角 $code_str =
Time of Update: 2016-07-21
0 與任意非數字(或者說,不可轉化為數位字元)前置的字串比較(操作符為==), 均返回 true.原因是, 數字與字串比較時, 先嘗試將字串轉換為數字, 再比較, 一個不能轉換為數位字串, 轉換結果為0, 故, 與0比較總返回 true.更加詳細的比較規則, 多種類型的比較規則, 在 PHP手冊/語言參考/運算子/比較子 可以找到.在PHP裡當兩個數字型字串(只含數位字串)進行比較的時候是直接轉換成數值進行比較的 如下樣本:(注意$a和$b兩個變數的最後一位不相等) 複製代碼 代碼如下:
Time of Update: 2016-07-21
array_intersect() 定義和用法 array_intersect() 函數返回兩個或多個數組的交集數組。 結果數組包含了所有在被比較數組中,也同時出現在所有其他參數數組中的值,鍵名保留不變。 注釋:僅有值用於比較。 文法 array_intersect(array1,array2,array3...)參數描述array1必需。與其他數組進行比較的第一個數組。array2必需。與第一個數組進行比較的數組。array3可選。與第一個數組進行比較的數組。可以有多個。例子 複製代碼
Time of Update: 2016-07-21
解決方案: 使用伺服器作為代理. 在PHP中, 使用我最喜歡的最強大的CURL,嘿嘿 下面是在萬網查詢網域名稱的執行個體代碼 複製代碼 代碼如下: $dn = $_GET['dn']; // 網域名稱, 不包括www $ex = $_GET['ex']; // 頂級網域名稱, 如 .com, .cn, 包括最前面的. // 查詢網域名稱是否已經註冊 $url = 'http://pandavip.www.net.cn/check/check_ac1.cgi'; $ch = curl_init($
Time of Update: 2016-07-21
不知道怎麼回事總是令人不舒服的,因此我通過閱讀源碼和查閱有限的資料簡要瞭解一下相關機制,本文是我對研究內容的總結。 本文首先解釋了安全執行緒的概念及PHP中安全執行緒的背景,然後詳細研究了PHP的安全執行緒機制ZTS(Zend Thread Safety)及具體的實現TSRM,研究內容包括相關資料結構、實現細節及運行機制,最後研究了Zend對於單線程和多線程環境的選擇性編譯問題。 安全執行緒