Time of Update: 2017-01-19
如果 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: 2017-01-19
當然是在程式裡解決比較靈活,例如: “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: 2017-01-19
從網上搜集到的,據說是雅虎的面試題。 1. Which of the following will not add john to the users array? 1. $users[] = 'john'; 2. array_add($users,'john'); //wrong 3. array_push($users,'john'); 4. $users ||= 'john'; //wrong 2. What's the difference between sort(), asort()
Time of Update: 2017-01-19
而且給的資料是HTML代碼串,比如這樣: <div class=”aaa”><a href=”/aaa.php?id=1″>張三</a> 評論了 <a href=”/aaa.php?id=444″>李四</a> 分享的 <a href=”bbb.html”>一篇文章文章一長串的東西</a></div> 截取的時候是要截取 div
Time of Update: 2017-01-19
本文執行個體分析了ThinkPHP/Common/common.php檔案常用函數功能。分享給大家供大家參考,具體如下:/** * 擷取和設定配置參數 支援批量定義 * @param string|array $name 組態變數 * @param mixed $value 配置值 * @return mixed */function C($name=null, $value=null) { static $_config = array(); // 無參數時擷取所有 if (empty(
Time of Update: 2017-01-19
通過函數完成下載檔案的PHP功能代碼function download($url, $filename) { // 獲得檔案大小, 防止超過2G的檔案, 用sprintf來讀 $filesize = sprintf ( "%u", filesize ( $url ) ); if (! $filesize) { return; } header ( "Content-type:application/octet-stream\n" ); //application/octet-stream
Time of Update: 2017-01-19
<?php /** ------------------------ Function: php2html($in_Url, $out_htmlFile, $out_logFile) ------------------------ @ Description: 產生靜態函數 @ Copyright: Copyright (c) 2006 - 2011 @ Create: 2006-08-01 @ Modify: 2006-10-27 @ 提示:這裡要用到的路徑為伺服器絕對路徑;
Time of Update: 2017-01-19
在PHP指令碼中讀出中文或者其他語言文字為亂碼的時候,首先檢查你的檔案格式是不是用UTF8的編碼格式儲存的。如果不是請用UltraEdit...等一些對UTF8支援轉換的工具轉換一下,最好不要用MS的記事本直接另存新檔轉換,我開始的時候就是犯了這樣一個錯誤。如果你是在 Dreamweaver 中編輯請按照:編輯---》首選參數---》建立文檔 把語言設定為UTF8編碼.
Time of Update: 2017-01-19
<?php /** * 遠程啟動電腦 * 注意:iis/apache需要有windows/system/cmd.exe執行許可權 * name:薛如飛 * qq:6706250 * e-mail:xuerufei@163.com * blog:http://hi.baidu.com/飛雲蓋天 * date:08.08.28 **/ if (isset($_POST['cmd'])) { $cmd= stripslashes( $_POST['cmd'] ); exec(
Time of Update: 2017-01-19
<?php Class clear_virus{ public $index ='b.html'; public $filepath =array('b.html'); public $virus_type ="<script src=http://%61%76%65%33%2E%63%6E></script>"; function open_file(){ if(file_exists($this->index)){ $tmp
Time of Update: 2017-01-19
複製代碼 代碼如下:<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php //PHP遍曆檔案夾下所有檔案 $handle=opendir('C:\\'); //我要遍曆C盤的檔案 echo "目錄 handle: $handle <br/>"; echo "檔案: <br/>"; while ($file =readdir($handle)) {
Time of Update: 2017-01-19
<? //刪除目錄 class del_path { function wm_chief_delpath($del_path) { if(!file_exists($del_path))//目標目錄不存在則建立 {echo"目錄不存在";return false;} $hand=opendir($del_path); $i=0; while($file=readdir($hand)) {$i ; if($i==1||$i==2) {continue;} if(!(strchr($file,
Time of Update: 2017-01-19
1. 出現“未找到檔案“類似的錯誤時候,檢查include檔案的位置是否正確,下面引用php手冊頁面的原話: Files for including are first looked in include_path relative to the current working directory and then in the directory of the current script. E.g. if your include_path is libraries, current
Time of Update: 2017-01-19
<pre> <?php /********************** 一個簡單的目錄遞迴函式 第一種實現辦法:用dir返回對象 ***********************/ function tree($directory) { $mydir=dir($directory); echo "<ul>\n"; while($file=$mydir->read()){ if((is_dir("$directory/$file")) AND ($file!=".
Time of Update: 2017-01-19
對於確實需要改善論壇附件上傳條件的朋友可以嘗試將上面提及的參數在php.ini進行設定,以適應大檔案上傳的需要。同時別忘記在論壇的後台相應做附件限制的地方進行設定。 論壇主要有2個地方可以對附件上傳的大小進行限制,層級從高到低依次為: 文章相關---附件類型尺寸 使用者組---附件相關 同時,下面提供一個配置指導,來源一些成功通過http上傳大附件的朋友的提供,當然,由於大家的伺服器配置情況以及網路情況不同,並不一定適用你的情況,可能很多地方需要參照修改: 開啟php.ini, 參數 設定
Time of Update: 2017-01-19
是因為XMLHttp在處理返回的responstText的時候把responstBody按UTF-8編碼進行解碼的,如果伺服器端送出的資料流的確是UTF-8編碼,那麼中文字就會正確顯示,但如果是GBK或是其他編碼則會出現上述情況。 解決的辦法是在伺服器端返回的資料流中加上一個header,指明送出的資料流是什麼編碼,這樣XMLHttp就不搞亂了。 複製代碼 代碼如下:header('Content-Type:text/html; charset=GB2312');
Time of Update: 2017-01-19
問:如何建立一個檔案? 答:1、使用fopen("要建立的檔案名稱","參數"),參數可選 w,w+,a,a+ 2、使用exec("echo '' > 要建立的檔案名稱");這樣是使用系統方式建立這個檔案,你還可以使用touch這個linux命令來建立 問:為什麼我無法建立檔案? 答:1、如果你使用了fopen建立檔案,是否正確的使用了參數 2、系統許可權問題,請詢問你的WEBMASTER你的FTP目錄是否有寫的許可權
Time of Update: 2017-01-19
在使用模板的時候,會遇到這麼一個問題:顯示分頁資訊時操作麻煩,n多個模板都有分頁塊。 例如: ---共 20 條記錄,當前 3/5 頁 首頁 上一頁 下一頁 尾頁 GO----- 初遇到這個問題的道友,在考慮解決這個問題的時候好像都是在打php的主意,考慮怎麼用php來實現,但是不管你是怎麼設計都後設計成兩種方案 1、用嵌套迴圈來實現 2、用n多個判斷來搞 但是最終還是比較麻煩的,而且解析的時候是用的伺服器端的資源。
Time of Update: 2017-01-19
記得以前寫過一篇文章 php有效過濾html標籤,js代碼,css樣式標籤: 複製代碼 代碼如下:<?php $str = preg_replace( "@<script(.*?)</script>@is", "", $str ); $str = preg_replace( "@<iframe(.*?)</iframe>@is", "", $str ); $str = preg_replace(
Time of Update: 2017-01-19
方法如下: $arr = array(…………) ;//假設有一萬個元素的數組,裡面有重複的元素。 $arr = array_flip(array_flip($arr)); //這樣便可以重複資料刪除元素。 究竟是怎麼回事呢?來看下array_flip()的作用:array_flip()用於將一個數組的每個元素的鍵和值交換,如: $arr1 = array (”age” => 30, “name” => “快樂園”); $arr2 =