Time of Update: 2017-01-13
查看伺服器 php 列表yum list | grep phphttp://dl.fedoraproject.org/pub/epel/5/x86_64/#rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpmrpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-rpm-macros-5-7.noarch.rpmrpm -
Time of Update: 2017-01-13
對於PHP初學者而言,在使用global關鍵字時,可能會發現,在函數內global一個函數外的變數,在某些情況下卻無法正確輸出該變數(即global變數無效)。下面我們來看一個簡單而常見的例子。在這裡,我們有a.php和b.php兩個頁面。b.php頁面代碼如下: 代碼如下複製代碼 <?php $site_name = 'CodePlayer';
Time of Update: 2017-01-13
此處所指的nbsp是實體,而不是nbsp四個字元 代碼如下複製代碼 $str = " abc"; $converted = strtr($str, array_flip(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES)));var_dump($converted); // 這兒才是要處理的字串,上面的都是準備工作
Time of Update: 2017-01-13
301跳轉 代碼如下複製代碼 header('HTTP/1.1 301 Moved Permanently'); header('Location: http://www.abc.com/aaa/'); exit(); 不要漏了header(‘HTTP/1.1 301 Moved Permanently’); 不然返回不了301404錯誤頁面 代碼如下複製代碼
Time of Update: 2017-01-13
PHP能開啟遠程或本地主機上的Socket連接埠。本文是一個使用Socket的小例子:連 接到一個Usenet新聞群組伺服器,同伺服器對話,從新聞群組中下載一些文章。在php中開啟一個socket 使用fsockopen()開啟一個socket.這個函數在php3和php4種都可以使用。函式宣告 是這樣的: int fsockopen (string hostname, int port [, int errno [, string errstr [, double timeout]]])
Time of Update: 2017-01-13
常用的字元處理函數 代碼如下複製代碼 strstr(string,string) = strchr(,) //從前面第一次出現某個字串的地方截取到最後strrchr(string,string) //從某個字串從最後出現的位置截取到結尾strpos(string,string[,int]) //某個字串第一次出現的位置strrpos(string,string) //某個字串最後一次出現的位置substr(string,int[,int])
Time of Update: 2017-01-13
隨機產生數數字mt_rand()函數 代碼如下複製代碼 $num = mt_rand(0,9999999); 但如果我想隨機產生字串怎麼操作,網站找到一個方法。 代碼如下複製代碼 function random($length) { srand(date("s")); $possible_charactors = "01234
Time of Update: 2017-01-13
漢字轉換成unicode方法 代碼如下複製代碼 <?php//將utf8編碼的漢字轉換為unicodefunction htou($c){ $n = (ord($c[0]) & 0x1f) << 12; $n = (ord($c[1]) & 0x3f) << 6; $n = ord($c[2]) & 0x3f; return
Time of Update: 2017-01-13
先看這個緩衝類<?php 代碼如下複製代碼 class cache{/*class name: cachedescription: control to cache data,$cache_out_time is a array to save cache date time out.version: 1.0author: 老農 cjjerlast modify:2006-2-26author url: http://www.111cn.net*/private
Time of Update: 2017-01-13
header("content-type: text/html;charset=gbk");//輸出編碼,避免中文亂碼?><html><head><title>ajax分頁示範</title><script language="網頁特效" >var http_request=false; function
Time of Update: 2017-01-13
mongo db是個好東西,越來越多的項目中有使用到。下面介紹如何安裝mongo擴充環境nginx/1.4.4PHP 5.4.22MongoDB 2.4.10下載擴充安裝包wget http://pecl.php.net/get/mongo-1.4.5.tgz編譯安裝tar xvf mongo-1.4.5.tgz -C /usr/srccd /usr/src/mongo-1.4.5/phpize./configure
Time of Update: 2017-01-13
安裝PHP擴充要求你的Mac系統已經安裝了Xcode環境和命令列開發工具,如果還沒安裝,請先使用Shell安裝。 xcode-select --install為了擴充管理方便,首先來安裝pecl擴充管理器。cd /usr/lib/phpsudo php install-pear-nozlib.phar安裝Redis、Memcache、Mongo等擴充。 sudo pecl install redissudo pecl install memcachesudo pecl
Time of Update: 2015-07-20
標籤: PHP 數組排序函數: sort() - 對數組進行升序排列 rsort() - 對數組進行降序排列 asort() - 根據關聯陣列的值,對數組進行升序排列 ksort() - 根據關聯陣列的鍵,對數組進行升序排列 arsort() - 根據關聯陣列的值,對數組進行降序排列 krsort() - 根據關聯陣列的鍵,對數組進行降序排列這些函數都是直接對原有數組進行操作,直接修改數組 sort() -
Time of Update: 2015-06-17
標籤:<?php$source = array(‘pll‘,‘我‘,‘愛‘,‘你‘,‘嘿‘);sort($source); //保證初始數組是有序的$last = count($source) - 1; //$source尾部元素下標$x = $last;$count = 1; //組合個數統計echo implode(‘,‘, $source), "<br>"; //輸出第一種組合while (true) { $y = $x--; //相鄰的兩個元素 if
Time of Update: 2014-10-10
標籤:blog http io os 使用 ar for strong 檔案 原文來自於:http://www.jb51.net/os/windows/62390.html正常情況下,我們在Wi
Time of Update: 2014-09-03
標籤:des style blog http color io strong ar for 上篇記錄了怎樣實現route,本篇記錄怎麼實現request,response。 Request
Time of Update: 2014-06-14
標籤:des style class blog code http cht=qr:必要參數,固定值<qr>,表明要產生二維碼chs=<width>x<height>:必要參數,產生二維碼尺寸,單位是像素,目前產生的二維碼都是正方形的,所以兩個寬高值都設定為一樣
Time of Update: 2014-05-12
標籤:style blog class code java c 原文地址:http://hi.baidu.com/lllangxx/item/3ccb7cdfa13b56eb3dc2cb39 一、學習如何管理Active Directory
Time of Update: 2014-05-24
錯誤記錄檔裝好 nginx-1.0.5 與 php-5.3.6(php-fpm) 迫不及待的測試 info.php(<?php phpinfo(); ?>),但是只返回了空白頁,什麼也沒有輸出,以下是錯誤記錄檔。192.168.6.82 - - [01/Aug/2011:13:54:20 +0800] "GET /info.php HTTP/1.1" 404 5 "-" "Mozilla/5.0 (X11; U; Linux x86_
Time of Update: 2014-05-10
環境:CentOS6.5 minimal目標:安裝Ganglia核心組件(gmond, gmetad, gmetric, gstat, libganglia)、Ganglia web準備yum加入 epel 源 rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpmyum加入 remi 源 rpm