Time of Update: 2016-07-25
$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,
Time of Update: 2016-07-25
$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:/
Time of Update: 2016-07-25
return array( 'database' => array( 'host' => '192.168.0.1', 'user' => 'administrator', 'password' => 'e1bfd762321e409cee4ac0b6e841963c', ),); ?>
Time of Update: 2016-07-25
header("Content-Type: application/vnd.ms-excel") 複製代碼如果希望能夠提供那個開啟/儲存的對話方塊,Content-Disposition參數,Content-Disposition參數本來是為了在用戶端另存檔案時提供一個建議的檔案名稱,但是考慮到安全的原因,就從規範中去掉了這個參數。Content-Disposition參數:attachment --- 作為附件下載 inline --- 線上開啟具體使用: header("Content-
Time of Update: 2016-07-25
/** * 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
Time of Update: 2016-07-25
//找到 Options FollowSymLinks AllowOverride None //修改為 Options FollowSymLinks AllowOverride All //就可以了 複製代碼在目錄下建立一個.htaccess檔案,windows預設是不允許這麼乾的, 可以在Dreamweaver的檔案管理下建立,就不會了。 .htaccess裡寫入 php_value post_max_size 12mphp_value
Time of Update: 2016-07-25
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'] =
Time of Update: 2016-07-25
function DJBHash($str) // 0.22{$hash = 0;$n = strlen($str);for ($i = 0; $i {$hash += ($hash }return $hash % 701819;} function ELFHash($str) // 0.35{$hash = $x = 0;$n = strlen($str); for ($i = 0; $i {$hash = ($hash if(($x = $hash & 0xf0000000) != 0){$
Time of Update: 2016-07-25
$html = HTML; $ver = '1.0.3';$p = "/(
Time of Update: 2016-07-25
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",
Time of Update: 2016-07-25
//用法 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();//
Time of Update: 2016-07-25
AuthType Basic AuthName "restricted area" AuthUserFile /full/path/to/passwordprotected/.htpasswd require valid-user 複製代碼第一行的AuthType指的是採用的認證方式,在這裡我們選擇的是一般的Basic,要注意的是,Basic認證方式傳輸密碼過程是不加密的,更安全的
Time of Update: 2016-07-25
function yige_constellation($month, $day) { // 檢查參數有效性 if ($month 12 || $day 31) return false; // 星座名稱以及開始日期 $constellations = array( array( "20" => "寶瓶座"), array( "19" => "雙魚座"), array( "21" => "白羊座"), array( "20" => "金牛座"), array( "21" => "
Time of Update: 2016-07-25
function my_scandir($dir){ $files=array(); if(is_dir($dir)){ if($handle=opendir($dir)){ while(($file=readdir($handle))!==false){ if($file!='.' && $file!=".."){ if(is_dir($dir."/".$file)){ $files[$file]=my_scandir($dir."/".$file); }else{
Time of Update: 2016-07-25
本文介紹下php-fpm設定檔與配置選項的一些內容,有需要的朋友參考下。本節介紹的是php5.3內建php-fpm檔案,如下:/usr/local/php/etc/php-fpm.confphp-fpm配置選項:pid = run/php-fpm.pidpid設定,預設在安裝目錄中的var/run/php-fpm.pid,建議開啟error_log = log/php-fpm.log錯誤記錄檔,預設在安裝目錄中的var/log/php-fpm.loglog_level = notice錯誤層級.
Time of Update: 2016-07-25
$file = 'jbxue.com.php'; //不支援遠程 $fso = fopen($file, 'r'); echo $data = fread($fso, filesize($file)); fclose($fso); ?>複製代碼fopen() 將 file 指定的名字資源綁定到一個流上. filesize 返迴文件大小的位元組數,如果出錯返回 FALSE. 注: 因為 PHP 的整數類型是有符號的,並且大多數平台使用 32 位整數,filesize() 函數在碰到大於 2GB
Time of Update: 2016-07-25
//下載擷取遠程圖片 function DownImageKeep($gurl, $rfurl, $filename, $gcookie="", $JumpCount=0, $maxtime=30) { $urlinfos = GetHostInfo($gurl); $ghost = trim($urlinfos['host']); if($ghost=='') { return FALSE; } $gquery
Time of Update: 2016-07-25
$P_S_T = $t_array[0] + $t_array[1]; $timestamp = time();session_start(); $ll_nowtime = $timestamp ; if (session_is_registered('ll_lasttime')){ $ll_lasttime = $_SESSION['ll_lasttime']; $ll_times = $_SESSION['ll_times'] + 1; $_SESSION['ll_times'] =
Time of Update: 2016-07-25
$con = file_get_contents("http://bbs.it-home.org/news/jb-1.html");$pattern="//";preg_match_all($pattern,$con,$match);print_r($match);?>複製代碼輸出結果:Array( [0] => Array ( [0] => [1] => [2] => ) [1] =
Time of Update: 2016-07-25
/* com_create_guid()是php5版本支援的功能,對於不支援的版本,可以自己進行定義 */ function guid(){ if (function_exists('com_create_guid')){ return com_create_guid(); }else{ mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up.