Time of Update: 2017-01-19
我們在編寫MIS系統和Web應用程式等系統時,都涉及到與資料庫的互動,如果資料庫中資料量很大的話,一次檢索所有的記錄,會佔用系統很大的資源,因此我們常常採用,需要多少資料就只從資料庫中取多少條記錄,即採用分頁語句。根據自己使用過的內容,把常見資料庫Sql Server,Oracle和MySQL的分頁語句,從資料庫表中的第M條資料開始取N條記錄的語句總結如下: SQL Server
Time of Update: 2017-01-19
一,搭建php環境下載php 5.2.6 源碼 並解壓編譯安裝,搭建php環境二,建立擴充項目進入源碼目錄cd php5.2.6/ext/./ext_skel --extname=my_ext建立名字為my_ext的項目,最終會產生my_ext.so三,更改配置和程式$ vi ext/my_ext/config.m4根據你自己的選擇將dnl PHP_ARG_WITH(my_ext, for my_ext support,dnl Make sure that the comment is
Time of Update: 2017-01-19
建立一個ANSI的PHP檔案,然後建立一個類: 複製代碼 代碼如下:header("Content-Type: text/html; charset=utf-8"); class Google_API_translator{ public $opts = array("text" => "", "language_pair" => "en|it"); public $out = ""; function setOpts($opts) { if($opts["text"] != "")
Time of Update: 2017-01-19
徐祖寧的php版的escape/unescape函數 複製代碼 代碼如下:function escape($str) { preg_match_all("/[\x80-\xff].|[\x01-\x7f]+/",$str,$r); $ar = $r[0]; foreach($ar as $k=>$v) { if(ord($v[0]) < 128) $ar[$k] = rawurlencode($v); else $ar[$k] = "%u".bin2hex(iconv("GB2312
Time of Update: 2017-01-19
複製代碼 代碼如下:<?php $url=$_GET['url']; $ext=pathinfo($url,PATHINFO_EXTENSION); if($ext!='jpg' && $ext!='gif'){ // 只支援jpg和gif readfile('/upload/20081209130557536.gif'); exit; } $file=md5($url).'.'.$ext; if(file_exists($file)){ readfile($file); exit;
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 // // Function: 擷取遠程圖片並把它儲存到本地 // // // 確定您有把檔案寫入本機伺服器的許可權 // // // 變數說明: // $url 是遠程圖片的完整URL地址,不可為空。 // $filename 是可選變數: 如果為空白,本地檔案名稱將基於時間和日期 // 自動產生. function GrabImage($url,$filename="") { if($url==""):return false;endif; if($filename==""
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
抓取到的內容在通過Regex做一下過濾就得到了你想要的內容,至於如何用Regex過濾,在這裡就不做介紹了,有興趣的,以下就是幾種常用的用php抓取網頁中的內容的方法。1.file_get_contents PHP代碼 複製代碼 代碼如下:<?php $url = "http://www.jb51.net"; $contents = file_get_contents($url); //如果出現中文亂碼使用下面代碼 //$getcontent = iconv("gb2312", "utf-8
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
有時候一分錢難死英雄漢, 這話不假, 在技術上也是一樣,如系統調試了半天, PHP就是不認mysql, 到頭來只是忘了安裝php5-mysql, miniBB因為簡約而美麗,但國內使用人數極少, 好多人都是因為中文亂碼而放棄, 好多系統都有這個問題, 畢竟人家老外開發的,也能理解, 在目錄下找到 bb_func_txt.php 注釋掉:$text=wrapText($wrap,$text); 問題解決。
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
複製代碼 代碼如下:<?php function getimageinfo(img) { //img為圖象檔案絕對路徑 img_info = getimagesize(img); switch (img_info[2]) { case 1: imgtype = "gif"; break; case 2: imgtype = "jpg"; break; case 3: imgtype = "png"; break; } img_type = imgtype."映像"; img_size =
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
在開始之前還是提一下三個函數吧:"ob_start()、ob_end_clean()、ob_get_contents()" ob_start():是開啟緩衝區的,就是要把您需要產生的靜態檔案的內容緩衝在這裡; ob_get_contents():是讀出緩衝區裡的內容,下面有代碼為例; ob_end_clean():這個比較重要,只有使用了這個函數後,緩衝區裡的內容才會讀取出來; 複製代碼
Time of Update: 2017-01-19
進行Chunked編碼傳輸的HTTP Response會在訊息頭部設定: Transfer-Encoding: chunked 表示Content Body將用Chunked編碼傳輸內容。
Time of Update: 2017-01-19
每頁多少條記錄($PageSize)? 當前是第幾頁($CurrentPageID)? 現在只要再給我一個結果集,我就可以顯示某段特定的結果出來。 至於其他的參數,比如:上一頁($PreviousPageID)、下一頁($NextPageID)、總頁數($numPages)等等,都可以根據前邊這幾個東西得到。 以mysql資料庫為例,如果要從表內截取某段內容,sql語句可以用:select * from table limit offset,
Time of Update: 2017-01-19
<a href="./">返回列表</a><br> <form action="<?echo $PHP_SELF;?>" method="post"> 在<input type="text" name="string" value="<?echo $string;?>">中尋找<input type="text" name="query" value="<?echo $query;?>">