Time of Update: 2018-12-08
可在編譯時間使用 –disable-cli。一旦編譯產生 CLI 模式的 PHP,則可能會被入侵者 利用該程式建立一個 WEB Shell 後門進程或通過 PHP 執行任意代碼! phpinfo() 功能描述:輸出 PHP 環境資訊以及相關的模組、WEB 環境等資訊。 危險等級:中 passthru() 功能描述:允許執行一個外部程式並回顯輸出,類似於 exec()。 危險等級:高 exec() 功能描述:允許執行一個外部程式(如 UNIX Shell 或 CMD 命令等)。 危險等級:高
Time of Update: 2018-12-08
UCHOME的代碼還是很不錯的,學習一下! 複製代碼 代碼如下:<?php /** * 定義一些常量 */ @define('IN_UCHOME', TRUE); //據說可以防止檔案非法包含 define('X_VER', '1.2'); //Uchome版本 define('X_RELEASE', '20080612');//發布日期 define('D_BUG', '0'); //是否開啟調試功能, 0:關閉, 1:開啟 //根據是否開啟調試功能設定錯誤報表層級
Time of Update: 2018-12-08
這裡經過摸索:找到了一個重新命名的方法,大家看看好不好使。 首先:我希望上傳的檔案根據日期來組織檔案夾 請修改editor\editor\filemanager\connectors\php檔案夾下的:config.php檔案 找到如下的內容: // Path to user files relative to the document root. $Config['UserFilesPath'] = 修改為: // Path to user files relative to the
Time of Update: 2018-12-08
以下內容僅摘錄部分:如果由我們來設計主題表和回帖表,通常的做法是如下。 這樣在擷取主題列表時,直接使用分頁演算法提取Topics;查看某一文章時,還需要對Topics,Posts進行jion連結。 此種設計的缺陷為: 1. Topics表格儲存體Content的內容,其體積將會很大,對大體積表進行分頁,效能很慢。 2. 顯示Posts內容時將進行join操作,損耗效能 而Discuz的做法是進行如下設計。
Time of Update: 2018-12-08
複製代碼 代碼如下:<html> <head> <title>插入一條新資料</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body> <form method="post" name="form1" action="insert.php"> <table align="
Time of Update: 2018-12-08
<?php $filename = "D:\\296.mid"; $file = fopen($filename, "rb"); $bin = fread($file, 2); //唯讀2位元組 fclose($file); $strInfo = @unpack("c2chars", $bin); $typeCode = intval($strInfo['chars1'].$strInfo['chars2']); $fileType = ''; switch ($typeCode) {
Time of Update: 2018-12-08
複製代碼 代碼如下:<?php $path = "D:\\in.txt"; try //檢測異常 { file_open($path); } catch(Exception $e) //捕獲異常 { echo $e->getMessage(); } function file_open($path) { if(!file_exists($path)) //如果檔案無法找到,拋出異常對象 { throw new Exception("檔案無法找到", 1); } if(!fopen($
Time of Update: 2018-12-08
複製代碼 代碼如下:<html> <head> <title>Form</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <body> <form action="post.php" method="get" name="form1"> <table width="271"
Time of Update: 2018-12-08
dump() 把數組以數組格式數組,有益於調試 function dump($vars, $label = '', $return = false){ if (ini_get('html_errors')) { $content = "<pre>\n"; if ($label != '') { $content .= "<strong>{$label} :</strong>\n"; } $content .= htmlspecialchars(print_r(
Time of Update: 2018-12-08
代碼如下: 複製代碼 代碼如下:<?php session_start(); define ('P_S', PATH_SEPARATOR); define ('ROOT', "./"); set_include_path(ROOT .P_S .'Zend' .P_S .ROOT.get_include_path()); //載入ZEND 架構 require_once ROOT.'Zend/Loader.php'; require_once
Time of Update: 2018-12-08
1、一周學會 PHP
Time of Update: 2018-12-08
方法如下: $arr = array(…………) ;//假設有一萬個元素的數組,裡面有重複的元素。 $arr = array_flip(array_flip($arr)); //這樣便可以重複資料刪除元素。 究竟是怎麼回事呢?來看下array_flip()的作用:array_flip()用於將一個數組的每個元素的鍵和值交換,如: $arr1 = array (”age” => 30, “name” => “快樂園”); $arr2 =
Time of Update: 2018-12-08
如果 time 的格式是絕對時間則 now 參數不起作用。如果 time 的格式是相對時間則其所相對的時間由 now 提供,或者如果未提供 now 參數時用目前時間。失敗時返回 -1。 <?php echo strtotime ("now"), "\n"; echo strtotime ("10 September 2000"), "\n"; echo strtotime ("+1 day"), "\n"; echo strtotime ("+1 week"), "\n"; echo
Time of Update: 2018-12-08
string str_pad ( string , int pad_length , string pad_string , int pad_type); string 指定字串,pad_length指定長度,pad_string用來填充的字串(選擇性參數),pad_type指定填充位置(選擇性參數,STR_PAD_LEFT,STR_PAD_BOTH); 如果pad_string , pad_type均為空白,那麼就等於預設pad_string 為空白格,
Time of Update: 2018-12-08
如果沒有提供 callback 函數,array_filter() 將刪除 input 中所有等值為 FALSE 的條目。 刪除數組中為空白值的元素就可以使用這個函數。 複製代碼 代碼如下://刪除數組中的一個元素 function array_remove_value(&$arr, $var){ foreach ($arr as $key => $value) { if (is_array($value)) { array_remove_value($arr[$key],
Time of Update: 2018-12-08
當然是在程式裡解決比較靈活,例如: “select convert(char,日期欄位,120) as date2 from table” convert(char,date,N)輸出的各中樣式 N 日期樣式 0 04 2 2005 9:06AM 1 04/02/05 2 05.04.02 3 02/04/05 4 02.04.05 5 02-04-05 6 02 04 05 7 04 02, 05 8 09:06:18 9 04 2 2005 9:06:18:857AM 10 04-02-05
Time of Update: 2018-12-08
<?php define ('P_S', PATH_SEPARATOR); define ('ROOT', "../"); set_include_path(ROOT .P_S .'Zend' .P_S .ROOT.get_include_path()); require_once ROOT.'Zend/Loader.php'; Zend_Loader::loadClass('Zend_Db'); Zend_Loader::loadClass('Zend_Config_Ini');
Time of Update: 2018-12-08
具體如下: 1>如我們知道開始時間,要加減一個時間,得出一個結果時間,可以用以下代碼 $time1='2008-10-1 12:30:30'; echo date('Y-m-d H:i:s',strtotime($time1)+30*60);//注意引號內的大小寫,分鐘是i不是m 執行結果:2008-10-01 13:00:30 2>若我們要計算兩個時間的差值,可以用以下方法: $time1='2008-10-1 12:30:30'; $time2='2008-10-1 13:45:
Time of Update: 2018-12-08
使用php就不一樣了,php包含了zlib的連結庫,可以直接使用其相關功能,下面是我寫的壓縮和結壓縮swf檔案的例子: //沒有加入判斷swf檔案是否已經壓縮,入需要可以根據檔案的第一個位元組是'F'或者'C'來判斷 壓縮swf檔案: //-------------------------------------------------------------------------------------------------- //檔案名稱 $filename = "test.swf";
Time of Update: 2018-12-08
複製代碼 代碼如下:$xmlfile = 'news/'.date('YmdH').'.xml'; $sourcexml = 'http://www.chinanews.com.cn/rss/scroll-news.xml'; if( !file_exists($xmlfile) ) { $str = @file($sourcexml) or die('負載檔案時出錯。'); $fp = fopen($xmlfile,'w') or die('寫緩衝失敗!'); fputs($fp,$str);