$headers['CLIENT-IP'] = '202.103.229.40'; $headers['X-FORWARDED-FOR'] = '202.103.229.40'; $headerArr = array(); foreach( $headers as $n => $v ) { $headerArr[] = $n .':' . $v; } ob_start();$ch = curl_init();curl_setopt ($ch, CURLOPT_URL,
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://localhost/index.php"); $r = rand(1,255); curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:8.8.8.'.$r, 'CLIENT-IP:125.8.8.'.$r)); //構造IP curl_setopt($ch, CURLOPT_REFERER, "http:/
/** * PDO 操作 * Created by PhpStorm. * User: sumiaowen * Date: 13-11-28 * Time: 下午9:12 * To change this template use File | Settings | File Templates. */class Pdo_db{ private $dns = null; private $username = null; private $password = null; private
/** * 這裡是 phpPgAdmin 的配置中心。使用者需要根據自己的實際情況修改這裡的設定。 * * $Id: config.inc.php-dist,v 1.53 2007/04/18 14:08:48 mr-russ Exp $ */ bbs.it-home.org // 一個樣本伺服器。你可以建立任意多個這樣的伺服器,索引從零開始遞增。 // 顯示在登陸螢幕上的伺服器名字 $conf['servers'][0]['desc'] = 'PostgreSQL'; //
//找到 Options FollowSymLinks AllowOverride None //修改為 Options FollowSymLinks AllowOverride All //就可以了 複製代碼在目錄下建立一個.htaccess檔案,windows預設是不允許這麼乾的, 可以在Dreamweaver的檔案管理下建立,就不會了。 .htaccess裡寫入 php_value post_max_size 12mphp_value
class QRCode{ public $w; public $h; public $s; function __construct($w1,$h1,$s1){ $this->w = $w1; $this->h = $h1; $this->s = $s1; $this->outimgase(); } function qrcode(){ $post_data = array(); $post_data['cht'] = 'qr'; $post_data['chs'] =
複製代碼在action.php中只要使用extract()函數將$_POST全域資料解開: action.php extract($_POST); //相當於$username = $_POST['username']; //$password = $_POST['password']; ?>複製代碼php手冊中的解釋:extract (PHP 4, PHP 5)extract — 從數組中將變數匯入到當前的符號表說明 int extract ( array $var_array [,
/***函數功能:計算兩個以YYYY-MM-DD為格式的日期,相差幾天**/function getChaBetweenTwoDate($date1,$date2){$Date_List_a1=explode("-",$date1);$Date_List_a2=explode("-",$date2);$d1=mktime(0,0,0,$Date_List_a1[1],$Date_List_a1[2],$Date_List_a1[0]);
sprintf(" %9.3f", 3.1415926); //靠右對齊:位元不夠用空格補全。結果:" 3.142"sprintf(" %-9.3f", 3.1415926); //靠左對齊:位元不夠用空格補全。結果:"3.142 "sprintf(" %.3f", 3.1415926); //不指定總寬度,結果:"3.142"複製代碼注意: $num = 100;sprintf("%.2f", $num );sprintf("%.2f",
//用法 echo remote_filesize($url,$user='',$pw='');$url = "http://www.aa.com/librarys/images/random/rand_11.jpg";//圖片地址echo remote_filesize($url,$user='',$pw='');function remote_filesize($uri,$user='',$pw=''){// start output buffering ob_start();//
function yige_constellation($month, $day) { // 檢查參數有效性 if ($month 12 || $day 31) return false; // 星座名稱以及開始日期 $constellations = array( array( "20" => "寶瓶座"), array( "19" => "雙魚座"), array( "21" => "白羊座"), array( "20" => "金牛座"), array( "21" => "
// 初始化一個 cURL 對象 $curl = curl_init(); // 設定你需要抓取的URL curl_setopt($curl, CURLOPT_URL, 'http://bbs.it-home.org'); // 設定header curl_setopt($curl, CURLOPT_HEADER, 1); // 設定cURL 參數,要求結果儲存到字串中還是輸出到螢幕上。 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //
if(isset($_GET['id'])){ $s=$_GET['id']; chdir($s); }echo '當前在'.getcwd(),'';$a=opendir('.');while($c=readdir($a)){ if(is_dir($c)) { $w=getcwd().'\\'.$c; echo $c."開啟"; } else { echo $c.''; } }?>複製代碼>
# Virtural hosts啟動虛擬機器主機的配置Include conf/extra/httpd-vhosts.conf ServerAdmin kongdaoxian@gmail.com DocumentRoot "E:/skydao/apache2/htdocs/zendTest/public" ServerName zendTest.com ServerAlias www.zendTest.com DirectoryIndex index.php
//選擇排序功能函數 //使用引用,減少記憶體消耗//整理:bbs.it-home.orgfunction &select(&$arr){ $count=count($arr); if($count>1){ for($i=0;$i $k=$i; for($j=$i+1;$j if($arr[$j] $k=$j;
$sudoapt-getinstallapache2複製代碼然後,運行apache:$sudo/etc/init.d/apache2restartapache在安裝期間將會建立一個目錄:/var/www,該目錄是該伺服器中存放文檔的根目錄。只要在瀏覽器的地址欄輸入http://localhost/或機器的ip地址就能訪問放置在此目錄中的所有文檔。二、安裝php伺服器配置安裝方法也很簡單: $sudo
function test($i){ $i-=4; if($ireturn $i; }else{ test($i); } } echotest(30);複製代碼程式碼分析:如果不運行一下估計你也不會認為他有什麼問題,及時運行起來發現有問題你也不一定知道哪裡有問題,但其實這個函數的else裡面是有問題的。在這段代碼裡面執行的結果是沒有傳回值的。所以雖然滿足條件 $i//php遞迴函式function test($i){ $i-=4; if($ireturn $i; }else{ return
本文介紹下PHP中常用的字元轉義函數、安全函數,用這些函數可以過濾大部份常見的攻擊手段,如SQL注入等。本節內容:php逸出字元函數用法。1. addslashesaddslashes對SQL語句中的特殊字元進行轉義操作,包括(‘), (“), (), (NUL)四個字元,此函數在DBMS沒有自己的轉義函數時候使用,但是如果DBMS有自己的轉義函數,那麼推薦使用原裝函數,比如MySQL有mysql_real_escape_string函數用來轉義SQL。
//資料庫我用的mysql PDO 但是整個思路又是一樣的$conn=mysql_connect('localhost','root','123');if(mysql_errno()){ printf('串連失敗'.mysql_error());}mysql_select_db('edeng');mysql_set_charset('utf8');/* *遞迴函式 *@param id 要查詢fid=$id的所有子類 這裡將$id的預設值為設為0
zend_optimizer.optimization_level=15 zend_extension_ts="d:phpendoptimizer.dll" zendoptimizer.dll的路徑一定要符合 複製代碼接著尋找extension_dir,在後面=加上你的windirsystem32目錄全稱,例如:extension_dir = d:windowssystem32 (最後的一定不能省略!)