Time of Update: 2016-06-07
PHP中echo(),print(),print_r(),return的區別?往往有很多新手和不太使用print()的朋友就答不好這個問題 從而面試失敗。那麼究竟她們有什麼區別呢?下面我們來看看答案:echo是PHP語句, print和print_r是函數,語句沒有傳回值,函數可以有傳回值(即便沒有用)print() 只能列印出簡單類型變數的值(如int,string)print_r() 可以列印出複雜類型變數的值(如數組,對象)return 語句
Time of Update: 2016-06-07
PHP PDO Access連結複製代碼 代碼如下:class DbHelpClass { private $conn; private $qxId; private $ret; function __construct() { $path="../../App_Data/sd#f#45G_!.mdb"; $constr="DRIVER={Microsoft Access
Time of Update: 2016-06-07
複製代碼 代碼如下:$urlcon= 'http://localhost/******.php';$data=' {"button":[{ "type":"click","name":"今日歌曲","key":"V1001_TODAY_MUSIC"},{"type":"click","name":"歌手簡介","key":"V1001_TODAY_SINGER"},{"name":"菜單","sub_button":[{"type":"click","name":"hello
Time of Update: 2016-06-07
注意32位機有2038問題,所以32位伺服器的年限範圍1970年~2038年我們還可以使用DateTime來規避這個問題(這樣與32位64位無關了)複製代碼 代碼如下:/** * * 我的日曆 * date_default_timezone_set date mktime * @param int $year * @param int $month * @param string $timezone * @author fc_lamp * @blog:
Time of Update: 2016-06-07
複製代碼 代碼如下: $text =
Time of Update: 2016-06-07
temp.html複製代碼 代碼如下:{penglig_site_title}test.php複製代碼 代碼如下:header('content-type:text/html; charset=utf-8');//防止產生的頁面亂碼$title = "PHP 動態產生靜態HTML頁面_指令碼之家"; //定義變數$url = "http://www.php.net/";$temp_file = "temp.html"; //臨時檔案,也可以是模板檔案$dest_file =
Time of Update: 2016-06-07
複製代碼 代碼如下:$arr = array(1,2,3,4,5);/*@ res 組裝好的每一注的每個元素@ $a 臨時數組@ $index 數組索引@ $arr 請求的數組@ $b 最後要的結果 */$a = array();$b = array();$total = 0;format($a,0,$arr);function format($res,$index,$arr){ global $total; global $b; $new_arr = $res; $n_arr =
Time of Update: 2016-06-07
例如你的原路徑是 http://localhost/test/index.php/index/add那麼現在的地址是 http://localhost/test/index/add如何去掉index.php呢?1、httpd.conf設定檔中載入了mod_rewrite.so模組 //在APACHE裡面去配置複製代碼 代碼如下:#LoadModule rewrite_module modules/mod_rewrite.so把前面的警號去掉2、AllowOverride None
Time of Update: 2016-06-07
代碼:複製代碼 代碼如下: /** * 把中間的看成一個可以滑動的固定長度的尺子 * * 把$this->_totalShowPages 當成一個可以滑動的固定長度尺子, * 然後$this->_totalPages就是一個給定長度的木塊,尺子在這個 * 木塊上滑動。情況兩種: * 1. 尺子長度大於木塊長度,那麼就直接輸出所有的頁碼; * 2. 尺子長度小於木塊長度,那麼就只用找到輸出這個尺子長度頁 * 數的起始點——$start,
Time of Update: 2016-06-07
方法一:複製代碼 代碼如下:$url="http://www.baidu.com"; file_get_contents($url); 方法二:複製代碼 代碼如下:// CURL 方法 $url="http://www.baidu.com"; $ch = curl_init( ); curl_setopt( $ch,CURLOPT_URL,$url ); curl_setopt( $ch,CURLOPT_HEADER,0 ); curl_setopt(
Time of Update: 2016-06-07
代碼如下:複製代碼 代碼如下:function getExchangeRate($from_Currency,$to_Currency){ $amount = urlencode($amount); $from_Currency = urlencode($from_Currency); $to_Currency = urlencode($to_Currency); $url =
Time of Update: 2016-06-07
複製代碼 代碼如下:function getIPLoc_QQ($queryIP){ $url = 'http://ip.qq.com/cgi-bin/searchip?searchip1='.$queryIP; $ch = curl_init($url); curl_setopt($ch,CURLOPT_ENCODING ,'gb2312'); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_
Time of Update: 2016-06-07
複製代碼 代碼如下:class Cache { private $dir = "data/cache/";//定義緩衝目錄 private $key='c_a_sss'; // 檔案名稱md5加密金鑰 function set_dir($dirpath) { $this->dir=$dirpath; $this->make_dir($this->dir); } function read($key,$minutes=1) { $filename=$this->get_filename($
Time of Update: 2016-06-07
calendar.class.php 複製代碼 代碼如下: class Calendar { private $year; //當前的年 private $month; //當前的月 private $start_weekday; //當月的第一天對應的是周幾 private $days; //當前月一共多少天 function __construct(){ $this->year=isset($_GET["year"]) ? $_GET["year"] : date("Y");
Time of Update: 2016-06-07
複製代碼
Time of Update: 2016-06-07
複製代碼 代碼如下:/*-------------------------------------------------- ip2address [qqwry.dat]--------------------------------------------------*/class ip { var $fh; //IP資料庫檔案控制代碼 var $first; //第一條索引 var $last; //最後一條索引 var $total; //索引總數 //建構函式 function
Time of Update: 2016-06-07
複製代碼 代碼如下:/** * 圖片加浮水印(適用於png/jpg/gif格式) * * @author flynetcn * * @param $srcImg 原圖片 * @param $waterImg 浮水印圖片 * @param $savepath 儲存路徑 * @param $savename 儲存名字 * @param $positon 浮水印位置 * 1:頂部居左, 2:頂部居右, 3:置中, 4:底部局左, 5:底部居右 * @param $alpha 透明度 --
Time of Update: 2016-06-07
複製代碼 代碼如下:$srcdir='./image/';$prefix="pic11_";$dst="image";$imagedir=scandir($srcdir);array_shift($imagedir);array_shift($imagedir);$width=0;$height=0;foreach ($imagedir as $key => $value) { $picinfo=getimagesize($srcdir.$value); $width=$picinfo[0]+$
Time of Update: 2016-06-07
複製代碼 代碼如下: /** * HOST: components.arrow.com */ //set_time_limit(0); // base function function curl_get($url, $data = array(), $header = array(), $timeout = 15, $port = 80, $reffer = '', $proxy = '') { $ch = curl_init(); if (!empty($data)) { $data =
Time of Update: 2016-06-07
複製代碼 代碼如下:// local file that should be send to the client$local_file = 'test-file.zip';// filename that the user gets as default$download_file = 'your-download-name.zip';// set the download rate limit (=> 20,5 kb/s)$download_rate =