Time of Update: 2016-07-25
filelist $dir = 'upload/';if(is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if($file!="." && $file!="..") { echo "".$file.""; } }
Time of Update: 2016-07-25
看到 http://www.oschina.net/code/snippet_106370_5983 這篇文章,測試的時候因為ip168網站禁止,所以試著在原有代碼上修改為ip138資料庫的資料調用 //原程式有問題,現修改為ip138資料庫 /** * 擷取IP地區 * Enter description here ... * @param
Time of Update: 2016-07-25
php類比post提交資料,用處很多,可用來網站的採集,登陸等等 //以程式登陸一個論壇登入狀態例function bbslogin($user_login, $password, $host, $port = "80") {//需要提交的post資料$argv = array('cookie' => array('user_login' => $user_login,
Time of Update: 2016-07-25
出處:http://www.crazyphper.com /** * 將日期格式根據以下規律修改為不同顯示樣式 * 小於1分鐘 則顯示多少秒前 * 小於1小時,顯示多少分鐘前 * 一天內,顯示多少小時前 * 3天內,顯示前天22:23或昨天:12:23。 * 超過3天,則顯示完整日期。 *
Time of Update: 2016-07-25
jpge圖片與png圖片的融合,其實就是大家熟悉的浮水印技術。下面代碼中最重要的一句為: //設定映像的混色模式 imagealphablending($ground_im, true); /* * 功能:PHP圖片浮水印 (浮水印支援圖片或文字) * 參數: * $groundImage 背景圖片,即需要加浮水印的圖片,暫只支援GIF,JPG,PNG格式; *
Time of Update: 2016-07-25
更新時間:20120102 /** * [WebodMin] (C)2010-2099 Blank Inc. * This is NOT a freeware, use is subject to license terms ***/function subistr($string, $length, $dot = ' ...') { global $
Time of Update: 2016-07-25
$file = 'jbxue.com.php';if (is_readable($file) == false) {die('檔案不存在或者無法讀取');} else {echo '存在';}?>複製代碼is_readable() 函數判斷指定檔案名稱是否可讀.指定的檔案或目錄存在並且可讀,則返回 TRUE例2: $filename = 'jbxue.com.php';if (file_exists($filename)) {echo "The file $filename exists";}
Time of Update: 2016-07-25
[Date]; Defines the default timezone used by the date functions;date.timezone =複製代碼預設是關閉的,只需把注釋去掉,改為即可 [Date]; Defines the default timezone used by the date functionsdate.timezone =
Time of Update: 2016-07-25
/** desc:檢網路地址格式是否有效 link:bbs.it-home.org date:2013/2/24*/function checkUrl($weburl) { return !ereg("^http(s)*://[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*$", $weburl); } ?>複製代碼2、判斷http 地址是否有效 /** desc:檢測http 地址是否有效 link:bbs.it-home.org date:2013
Time of Update: 2016-07-25
{ title }this is a { file } file's templets 複製代碼PHP處理: templetest.php $title = "測試模板";$file = "TwoMax Inter test templet,author:Matrix@Two_Max"; $fp = fopen ("temp.html","r");$content = fread ($fp,filesize ("temp.html"));$content .= str_replace ("{
Time of Update: 2016-07-25
ob_start();#開啟伺服器緩衝include_once 'Index.php';$ctx=ob_get_contents();#擷取緩衝ob_end_clean();#清空緩衝$fh=fopen("index.html","w+");fwrite($fh,$ctx);#寫入html,產生htmlfclose($fh);?>複製代碼方法2:php 靜態檔案產生類 class CreateHtml{function mkdir( $prefix= 'article' ){$y = date(
Time of Update: 2016-07-25
/** * 根據html代碼擷取word文檔內容 * 建立一個本質為mht的文檔,該函數會分析檔案內容並從遠程下載頁面中的圖片資源 * 該函數依賴於類MhtFileMaker * 該函數會分析img標籤,提取src的屬性值。但是,src的屬性值必須被引號包圍,否則不能提取 * * @param string $content HTML內容 * @param string $absolutePath
Time of Update: 2016-07-25
實現上傳圖片的功能 date_default_timezone_set("PRC");header("content-type:text/html;charset=utf-8");require_once("./function1.php");if(isset($_GET['act']) && ($_GET['act']
Time of Update: 2016-07-25
本文是php-redis中文文檔的第五部分,有需要的朋友可以參考下。本文是php-redis中文文檔的第五部分,有需要的朋友可以參考下。Hash操作hSet$redis->hSet('h', 'key1', 'hello');向名稱為h的hash中添加元素key1—>hello hGet$redis->hGet('h', 'key1');返回名稱為h的hash中key1對應的value(hello) hLen$redis->hLen('h');返回名稱為h的hash中元素個數
Time of Update: 2016-07-25
function set_writeable($file_name){if(@chmod($file_name,0555)){ echo "修改index.php檔案唯讀屬性成功";}else{ echo "修改index.php檔案唯讀屬性失敗,空間商不支援此操作!";}}set_writeable("index.php");?>
Time of Update: 2016-07-25
//顯示訪問使用者的瀏覽器資訊echo 'Browser: ' . determinebrowser($Agent) . '';//顯示訪問使用者的作業系統平台echo 'Platform: ' . determineplatform($Agent). '';//正值運算式比對解析$_SERVER['HTTP_USER_AGENT']中的字串 擷取訪問使用者的瀏覽器的資訊function determinebrowser ($Agent) {$browseragent="";
Time of Update: 2016-07-25
//讀取xml $dom=new DOMDocument('1.0');$dom->load('data.xml');$em=$dom->getElementsByTagName('videos');//最外層節點$em=$em->item(0);$items=$em->getElementsByTagName('video');//節點//如果不用讀取直接添加的話把下面這一段去掉即可foreach($items as $a){foreach($a->attributes as
Time of Update: 2016-07-25
final class UserLogin { public function __construct() { } public static function getUserInfo() { if (isset($_COOKIE["user_id"])&&$_COOKIE["user_id"]&&(trim($_COOKIE["user_id"])!="")) { if
Time of Update: 2016-07-25
function maoPao($arr,$style)//預設傳遞的是值,不是地址。如果在$arr前加個&,則和$arr1指向同一個地址,函數外的$arr1也被排好了 { $temp=0; $flag=false; for($i=0;$i{ for($j=0;$j{ if($style=='bts') $op=$arr[$j]else if($style=='stb') $op=$arr[$j]>$arr[$j+1]; if($op) { $temp=$arr[$j];
Time of Update: 2016-07-25
select FROM_UNIXTIME(pubtime, '%Y-%m') as pubtime, count(*) as cnt from articles group by FROM_UNIXTIME(pubtime, '%Y-%m')複製代碼PHP文章按日期(日)SQL歸檔 select FROM_UNIXTIME(pubtime, '%Y-%m-%d') as pubtime, count(*) as cnt from articles group by