Time of Update: 2016-07-25
//格式化資料(防止注入)function site_addslashes($string, $force = 0) {!defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());if(!MAGIC_QUOTES_GPC || $force) {if(is_array($string)) {foreach($string as $key => $val) {$string[$key] =
Time of Update: 2016-07-25
在與其他系統進行WEBSERVICE對接的時候發現,PHP無法識別.NET下的時間參數。分析:PHP中的調用WEBSERVICE代碼是手工編寫xml格式的資料包來實現的在與其他系統進行WEBSERVICE對接的時候發現,PHP無法識別.NET下的時間參數。分析:PHP中的調用WEBSERVICE代碼是手工編寫xml格式的資料包來實現的,並不像我們.NET 和
Time of Update: 2016-07-25
$arr1 = array(1,9,5); $arr2 = array(6,2,4); array_multisort($arr1,$arr2); print_r($arr1); // 得到的順序是1,5,9 print_r($arr2); // 得到的順序是6,4,2複製代碼我估計兩個數組的值自始至終都是對應著的:1對應6,9對應2,5對應4。 再加多一個數組看看會怎樣: $arr1 = array(1,9,5); $arr2 = array(6,2,4); $arr3 = array(3,
Time of Update: 2016-07-25
#------------------------------------------# # XML Library, by Keith Devens, version 1.2b # http://keithdevens.com/software/phpxml # # This code is Open Source, released under terms similar to the Artistic License. # Read the license at
Time of Update: 2016-07-25
$arr1 = array('10', 11, 100, 100, 'a'); $arr2 = array(1, 2, 3, '2', 5); array_multisort($arr1, $arr2); ?>複製代碼結果為: $arr1 Array ( [0] => 10 [1] => a [2] => 11 [3] => 100 [4] => 100 ) # '10'在與11, 100, 100比較時轉換為整數10,小於其他三個數 #
Time of Update: 2016-07-25
/**php自動產生月曆link:bbs.it-home.org 2013-3-7*/ function calendar($MM,$YYYY){ if($MM=="") $MM = date("m"); if($YYYY=="") $YYYY = date("Y"); if(checkdate($MM,1,$YYYY)){ $stringDate = strftime("%d %b %Y",mktime (0,0,0,$MM,1,$YYYY));
Time of Update: 2016-07-25
function arraysort($data, $order = 'asc') { //asc升序 desc降序 $temp = array (); $count = count ( $data ); if ($count return false; //傳入的資料不正確 if ($order == 'asc') { for($i = 0; $i for($j = $count - 1; $j > $i; $j --) { if ($data [$j] //交換兩個資料的位置 $temp =
Time of Update: 2016-07-25
/** php產生word檔案 link:bbs.it-home.org*/$word = new COM("word.application") or die("無法啟動 Word 程式!");$word->Visible = 0;$n=$word->Documents->Add();## 分節符號$n->Sections->Add($word->Selection->Range,0);##
Time of Update: 2016-07-25
@session_start(); require_once("../inc/ring_admin.php"); require_once("../../inc/connect.php"); require_once("../../admin/inc/function.php"); ring_login(); $pwd = get_value('pwd','post'); $pwd2 = get_value('pwd2','post');
Time of Update: 2016-07-25
/* * php自動產生新密碼自訂函數 適用環境: PHP5.2.x / mysql 5.0.x 代碼作者: xujiajay* */function genPassword($min = 5, $max = 8) { $validchars="abcdefghijklmnopqrstuvwxyz123456789"; $max_char=strlen($validchars)-1; $length=mt_rand($min,$max);
Time of Update: 2016-07-25
require_once '../libs/PHPWord/PHPWord.php';require_once '../libs/PHPWord/PHPWord/IOFactory.php';require_once '../../config.php';// require_once '../common/conn.php';// New Word Document$PHPWord = new PHPWord();/**********文字格式設定的word text.php*********
Time of Update: 2016-07-25
$fruits = array("apple","banana");array_unshift($fruits,"orange","pear")// $fruits = array("orange","pear","apple","banana");複製代碼在數組尾添加元素array_push()函數的傳回值是int型,是壓入資料後數組中元素的個數,可以為此函數傳遞多個變數作為參數,同時向數組壓入多個變數。其形式為:(array array,mixed variable [,mixed
Time of Update: 2016-07-25
header("Content-type:text/html;charset=utf-8");$cookie_file = dirname(__FILE__)."/cookie_".md5(basename(__FILE__)).".txt"; // 設定Cookie檔案儲存路徑及檔案名稱function vlogin($url,$data){ // 類比登入擷取Cookie函數 $curl = curl_init(); // 啟動一個CURL會話
Time of Update: 2016-07-25
function jk1986_checksql(){$bad_str = "and|select|update|'|delete|insert|*";$bad_Array = explode("|",$bad_str);/** 過濾Get參數 **/foreach ($bad_Array as $bad_a){foreach ($_GET as $g){if (substr_count(strtolower($g),$bad_a) > 0){echo "";exit();}}}/**
Time of Update: 2016-07-25
/** * Factory 方法模式 * ------------- * @author zhangqian * @version v1.0 */ //緩衝介面 interface cache { public function init($conf); public function setVal($key , $val); public function getVal($key)
Time of Update: 2016-07-25
$con = array(array("newtitle","newcontent"),array("newtitle2","newcontent2"));foreach($con as $id=>$val){ $title = $val[0]; $content = $val[1]; $path = $id.'.htm'; $fp = fopen("jia.htm", "r"); //開啟檔案,唯讀方式 $str = fread($fp,
Time of Update: 2016-07-25
$str=decode("gb2312",$names[$index]);@chars=split(//,$str);foreach(@chars){$char=encode("gb2312",$_);print "ONE WORD:$char\n";}複製代碼方法二:中文字元是佔了2個位元組,所以你可以用下面語句直接得到漢字,代碼如下: @chars=split(//,$names[$index]);$str=$chars[0].$chars[1];複製代碼
Time of Update: 2016-07-25
通常本地程式傳送到伺服器上,會出現各種未定義的NOTICE提示,並不算是錯誤,只是警告。可以在錯誤語句前加上@,也可以修改PHP.INI。通常本地程式傳送到伺服器上,會出現各種未定義的NOTICE提示,並不算是錯誤,只是警告。可以在錯誤語句前加上@,也可以修改PHP.INI。這是由於PHP.INI裡的 error_reporting = E_ALL 造成的,如果不希望看到這個提示,可以這樣:error_reporting = E_ALL &~E_NOTICE 。也可在頁面頂部加上
Time of Update: 2016-07-25
[root@localhost ~]# mkdir -p /lcf/upan[root@localhost ~]# mkdir -p /lcf/cdrom[root@localhost ~]# mkdir -p /lcf/xpdf[root@localhost ~]# cd /lcf/upan/[root@localhost upan]# cp xpdf/* ../xpdf/ (下載的檔案放入/lcf/xpdf目錄)[root@localhost upan]# cd ../xpdf/[root@
Time of Update: 2016-07-25
if( empty($_GET['FileName'])|| empty($_GET['FileDir'])|| empty($_GET['FileId'])){echo''; exit();}$file_name=$_GET['FileName'];$file_dir=$_GET['FileDir'];$FileId=$_GET['FileId'];$file_dir = $file_dir."/";if (!file_exists($file_dir.$file_name)) {