Time of Update: 2016-06-07
需要安裝擴充shmop找到php安裝源檔案目錄複製代碼 代碼如下:# cd /usr/local/php-5.4.0/ext/shmop# /usr/local/php/bin/phpize# ./configure --with-php-config=/usr/local/php/bin/php-config# make && make install編譯安裝成功複製代碼 代碼如下:# cd
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
1.執行複製代碼 代碼如下:yum install php-mbstring2. 修改php.ini (這一步非常重要, 部分lxadmin版本無法自動修改)複製代碼 代碼如下:echo ‘extension=mbstring.so' >>/etc/php.ini #更具php安裝目錄而定3. 重啟web service如果是apache: service httpd restart方法二:php 5.36安裝目錄:/usr/local/php 複製代碼 代碼如下:#cd
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
複製代碼 代碼如下:// include classinclude 'SitemapGenerator.php';// create object$sitemap = new SitemapGenerator("http://www.php.net");// add urls$sitemap->addUrl("http://your.php.net", date('c'), 'daily', '1');$sitemap->addUrl("http://your.php.net",
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
什麼是HTTP Referer簡言之,HTTP Referer是header的一部分,當瀏覽器向web伺服器發送請求的時候,一般會帶上Referer,告訴伺服器我是從哪個頁面連結過來的,伺服器籍此可以獲得一些資訊用於處理。比如從我首頁上連結到一個朋友那裡,他的伺服器就能夠從HTTP
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
複製代碼 代碼如下:/** * $string 明文或密文 * $operation 加密ENCODE或解密DECODE * $key 密鑰 * $expiry 密鑰有效期間 */ function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) { // 動態密匙長度,相同的明文會產生不同密文就是依靠動態密匙 //
Time of Update: 2016-06-07
複製代碼 代碼如下:function getAgeByID($id){ //過了這年的生日才算多了1周歲 if(empty($id)) return ''; $date=strtotime(substr($id,6,8));//獲得出生年月日的時間戳記 $today=strtotime('today');//獲得今日的時間戳記
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
下面提供兩種方法,僅供研究使用。第1種方法:複製代碼 代碼如下:$host="localhost";$user="root";$password="";$dbname="dbname";mysql_connect($host,$user,$password);mysql_select_db($dbname);$mysql= "set names utf8;";mysql_query($mysql);$q1=mysql_query("show
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
emailclass.php複製代碼 代碼如下:class CMailFile {var $subject; var $addr_to; var $text_body; var $text_encoded; var $mime_headers; var $mime_boundary = "--==================_846811060==_"; var $smtp_headers;function
Time of Update: 2016-06-07
使用圖形顯示Ip,檔案 sunip.php 複製代碼 代碼如下:header("Content-type: image/gif"); $im = imagecreate(130,15); $background_color = ImageColorAllocate ($im, 255, 255, 255); unset($ip); if($_SERVER['HTTP_CLIENT_IP']){ $ip=$_SERVER['HTTP_CLIENT_IP']; } else if($_SERVER[