Time of Update: 2016-06-07
密碼編譯演算法如下:複製代碼 代碼如下:function encrypt($data, $key){ $key = md5($key); $x = 0; $len = strlen($data); $l = strlen($key); for ($i = 0; $i { if ($x == $l) { $x = 0; } $char .= $key{$x}; $x++;
Time of Update: 2016-06-07
複製代碼 代碼如下:function simsimi($keyword) { $keyword = urlencode(urlencode($keyword)); //----------- 擷取COOKIE ----------// $url = "http://www.simsimi.com/"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER,1); curl_setopt($ch,
Time of Update: 2016-06-07
百度翻譯API的PHP代碼,測試可以實現,不過英譯中可能需要轉換編碼。複製代碼 代碼如下:function language($value,$from="auto",$to="auto"){ $value_code=urlencode($value); #首先對要翻譯的文字進行 urlencode 處理 $appid="YourApiKey"; #您註冊的API Key $languageurl =
Time of Update: 2016-06-07
複製代碼 代碼如下:/*-----儲存COOKIE-----*/$url = 'www.xxx.com'; //url地址$post = "id=user&pwd=123456"; //POST資料$ch = curl_init($url); //初始化curl_setopt($ch,CURLOPT_HEADER,1); //將標頭檔的資訊作為資料流輸出curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
Time of Update: 2016-06-07
複製代碼 代碼如下:/** 檢測百度是否收錄網頁 curl模式* @ param string $url傳入的url* return int (1 收錄 0 不收錄)*/function
Time of Update: 2016-06-07
複製代碼 代碼如下:/*-------------------------------------------------- ip2address [qqwry.dat]--------------------------------------------------*/class ip { var $fh; //IP資料庫檔案控制代碼 var $first; //第一條索引 var $last; //最後一條索引 var $total; //索引總數 //建構函式 function
Time of Update: 2016-06-07
靚點:1、多對多交叉情境分配;2、php新特性-閉包使用、批處理函數array_walk/array_flip使用;3、位元運算&使用案例;使用情境:1、常見增刪改查(2的N次方值入庫);2、認證、第三方帳號綁定、多分類選擇;複製代碼 代碼如下:class s_allow{//聲明使用情境,任務清單public $scene,$case_list=array();//聲明指定使用者角色、允許值、允許清單public
Time of Update: 2016-06-07
php5.3內建php-fpm複製代碼 代碼如下:/usr/local/php/etc/php-fpm.confpid = run/php-fpm.pidpid設定,預設在安裝目錄中的var/run/php-fpm.pid,建議開啟error_log = log/php-fpm.log錯誤記錄檔,預設在安裝目錄中的var/log/php-fpm.loglog_level = notice錯誤層級. 可用層級為: alert(必須立即處理), error(錯誤情況), warning(警告情況),
Time of Update: 2016-06-07
複製代碼 代碼如下:set_time_limit(0);$str = str_pad($str, 512, "0");$file = fopen("./temp","a+");$i = 0;$bytes = 1000000000;$mygabyte = $bytes/1000000;echo "test start. waiting ...";$starttime = time();while($i $i += fwrite($file, $str);}$endtime = time()
Time of Update: 2016-06-07
複製代碼 代碼如下: //require_once('FirePHPCore/FirePHP.class.php'); //$firephp = FirePHP::getInstance(true); // debugger in firefox class SimpleDao { private $_table = null; private static $_con = null; public function
Time of Update: 2016-06-07
對於現在的應用程式來說,日誌的重要性是不言而喻的。很難想象沒有任何日誌記錄功能的應用程式運行在生產環境中。日誌所能提供的功能是多種多樣的,包括記錄程式運行時產生的錯誤資訊、狀態資訊、調試資訊和執行時間資訊等。在生產環境中,日誌是尋找問題來源的重要依據。應用程式運行時的產生的各種資訊,都應該通過日誌類庫來進行記錄。複製代碼 代碼如下:/** * Tlog類 * * @since alpha 0.0.1 * @date 2014.03.04 * @author genialx *
Time of Update: 2016-06-07
安裝(fastcgi模式)的時候,常常有這樣一句命令:複製代碼
Time of Update: 2016-06-07
複製代碼 代碼如下:$id = "http://www.php.net";$token = encrypt($id, 'E', 'php');echo '加密:'.encrypt($id, 'E', 'php');echo '';echo '解密:'.encrypt($token, 'D',
Time of Update: 2016-06-07
複製代碼 代碼如下:/** * 圖片加浮水印(適用於png/jpg/gif格式) * * @author flynetcn * * @param $srcImg 原圖片 * @param $waterImg 浮水印圖片 * @param $savepath 儲存路徑 * @param $savename 儲存名字 * @param $positon 浮水印位置 * 1:頂部居左, 2:頂部居右, 3:置中, 4:底部局左, 5:底部居右 * @param $alpha 透明度 --
Time of Update: 2016-06-07
複製代碼 代碼如下:$srcdir='./image/';$prefix="pic11_";$dst="image";$imagedir=scandir($srcdir);array_shift($imagedir);array_shift($imagedir);$width=0;$height=0;foreach ($imagedir as $key => $value) { $picinfo=getimagesize($srcdir.$value); $width=$picinfo[0]+$
Time of Update: 2016-06-07
複製代碼 代碼如下: /** * HOST: components.arrow.com */ //set_time_limit(0); // base function function curl_get($url, $data = array(), $header = array(), $timeout = 15, $port = 80, $reffer = '', $proxy = '') { $ch = curl_init(); if (!empty($data)) { $data =
Time of Update: 2016-06-07
複製代碼 代碼如下:$file = 'video_file';$config['upload_path'] = './video_folder/';$config['allowed_types'] = 'mov|mpeg|mp3|avi';$config['max_size'] = '50000';$config['max_width'] = '';$config['max_height'] =
Time of Update: 2016-06-07
複製代碼 代碼如下:$rfr = $_SERVER['HTTP_REFERER'];//if(!$rfr) $rfr='http://'.$_SERVER['HTTP_HOST']; if($rfr){ $p=parse_url($rfr); parse_str($p['query'],$pa); $p['host']=strtolower($p['host']); $arr_sd_key=array( 'baidu.com'=>'word', 'google.com'=>'q'
Time of Update: 2016-06-07
複製代碼 代碼如下:// local file that should be send to the client$local_file = 'test-file.zip';// filename that the user gets as default$download_file = 'your-download-name.zip';// set the download rate limit (=> 20,5 kb/s)$download_rate =
Time of Update: 2016-06-07
//遞迴獲得角色ID字串function explodeRole($roleObj, &$resultStr){ if(0 childRoleObjArr)){ foreach($roleObj->childRoleObjArr as $childRoleObj){ if('' == $resultStr){ $resultStr .= "{$childRoleObj->id}"; }else{ $resultStr .= ",