Time of Update: 2016-07-29
[root@localhost ~]#vi /etc/init.d/nginx #建立檔案#!/bin/bash# nginx Startup script for the Nginx HTTP Server# it is v.0.0.2 version.# chkconfig: - 85 15# description: Nginx is a high-performance web and proxy server.# It has a lot of
Time of Update: 2016-07-29
1. 下載源碼:$ cd /usr/downloads$ wget -c http://nginx.org/download/nginx-1.8.1.tar.gz$ tar -xvf nginx-1.8.1.tar.gz$ cd nginx-1.8.12. 安裝依賴:pcre1) 首次嘗試安裝$ cd ..$ wget -c ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre2-10.21.tar.gz$ tar -xvf
Time of Update: 2016-07-29
data-id="1190000005001849" data-licence="">Memcache和Memcached 其實是一個東西,只是php中要是用的擴充不一樣一個是 php_memcache.dll 和 php_memcached.dll , 2009年左右有人豐富memcache的用法和效能,才有了memcached ,用法也有了很大的改進比如添加了 getMulti() 批量擷取索引值Memcache 類$memcache = new
Time of Update: 2016-07-29
data-id="1190000004999380"
Time of Update: 2016-07-29
有的中文的半形,圓角空格或者段落符顯示為空白的。可以用正則來處理preg_replace("/(\s|\ \;| |\xc2\xa0)/","",$content);').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i))
Time of Update: 2016-07-29
伺服器位址:192.168.1.231網域名稱:test1.com 目錄:/www/test1.com網域名稱:test2.com 目錄:/www/test2.com該配置思路把2個網站 test1.com, test2.com 放到 nginx 可以訪問的目錄 /www/給每個網站分別建立一個 nginx 設定檔 test1.com.conf,test2.com.conf, 並把設定檔放到 /etc/nginx/vhosts/然後在 /etc/nginx.conf 裡面加一句 include
Time of Update: 2016-07-29
empty()函數用來判斷字串是否為空白只要變數是0,null,'',false,empty()都判斷為true。 $num1=''; $num2=0; echo $num1==$num2; echo ''; echo $num1===$num2 ? '1' : '0';結果為:原因是在PHP中變數時以C語言的結構體來儲存的,Null
Time of Update: 2016-07-29
最近要搭建nginx伺服器和ftp服務nginx伺服器線上安裝 $sudo apt-get install nginx安裝nginx依賴包運行命令: sudo apt-get install libssl-dev sudo apt-get install libpcre3 libpcre3-dev啟動Nginx $sudo /etc/init.d/nginx startubuntu 14.04 安裝vsftpd提示530 Login incorrectftp localhost
Time of Update: 2016-07-29
/** * PHP Class for queue * @author yangqijun@live.cn * @copyright DataFrog Beijingbei Ltd. 2011-07-25 */classQueue {public$length=12; //預設隊列,相當於初始化隊列public$queue = array(); // if String like this "22,23,24" convert to array to
Time of Update: 2016-07-29
系統用到一個遠端資料庫。地點在USA,連線速度特別慢。DBA又不給導資料庫 只好自己寫一個資料庫表遷移的方法。但是只能一次一張錶慢慢的導。使用PHP編寫//原資料庫$databaseOri = '原資料庫名稱'; $hostnameOri = 'IP地址'; $portOri = '連接埠號碼'; $userOri = '使用者名稱'; $passwordOri = '密碼';
Time of Update: 2016-07-29
1.php函數傳遞參數的方式,到底是傳遞變數的地址還是傳遞變數的值;1.1定義一個類class Penson{public $age;public $name;}//執行個體化一個對象$zs=new Penson();$zs->age=10;1.2 分別定義一個字串,數字,數組;$str="string";$num="0";$myArray=(10,100,100);1.3定義一個函數funtion test($str,$num,$arr,$obj){$str="change
Time of Update: 2016-07-29
function getImg($url,$filename){ if($url == '') return false; //開啟輸出控制緩衝 ob_start(); //讀取url圖片檔案,並寫入到輸出緩衝 readfile($url); //返回輸出緩衝區的內容 $img = ob_get_contents(); //清空輸出緩衝區的內容
Time of Update: 2016-07-29
yii2 記錄角色的注意事項今天寫 yii2 的 RBAC 應用,打算簡單修改原有關於角色的記錄,就能切換到新的許可權,然後出現了這麼個錯誤:unserialize(): Error at offset 36 of 127 bytes排除了許可權結構(許可權名稱、角色名稱、使用的 authManager
Time of Update: 2016-07-29
//////////////////////php代碼部分public function snoopy() { require_once APP_PATH . 'Home/Model/Snoopy.class.php'; //include 'Home/Model/Snoopy.class.php'; //載入Snoopy類 $snoopy = new \Snoopy(); //執行個體化一個對象
Time of Update: 2016-07-29
'log'=>array('class'=>'CLogRouter','routes'=>array( array( 'class'=>'CWebLogRoute', 'levels'=>'trace', //profile 'categories'=>'system.db.*', //'categories'=>'system.db.CDbCommand,system.caching.*',), ),
Time of Update: 2016-07-29
如果PHP語句放在一個HTML檔案中,它是不會被處理的。但是,如果使用require()語句載入這個HTML檔案,檔案內的任何PHP命令都會被調用。因此,可以使用任何副檔名來命名包含檔案,但要遵循一個約定,例如將副檔名命名為.inc或.php是一個很好的辦法。若不用.php副檔名命名,需要將待引入檔案放置於文檔樹之外,避免使用者在瀏覽器中直接載入後以文本形式查看原始碼。若副檔名為.php,但只包含部分頁面或指令碼,此時可能會引起錯誤。注意:無論副檔名採用哪一種,待引入的檔案中PHP代碼必須放置在
Time of Update: 2016-07-29
58-定義函數的過程在PHP中,使用者函數的定義從function關鍵字開始。如下所示簡單樣本:function foo($var) { echo $var;}這是一個非常簡單的函數,它所實現的功能是定義一個函數,函數有一個參數,函數的內容是在標準輸出端輸出傳遞給它的參數變數的值。函數的一切從function開始。我們從function開始函數定義的探索之旅。詞法分析在 Zend/zend_language_scanner.l中我們找到如下所示的代碼:"function" {
Time of Update: 2016-07-29
最近在做一個網頁應用,網頁是中文,編碼UTF-8,在安卓手機上正常,但是在iPhone上出現了奇怪的亂碼。系統是Ubuntu 14.04 LTS,PHP + APACHE多方查閱資料,發現文檔編碼和系統編碼不同,或者網頁檔案中沒有聲明編碼,都會導致這個問題。系統中通過cat /etc/default/locale查看編碼環境後,發現系統編碼是UTF8,沒有問題。在網頁中加入 後,iPhone顯示仍然亂碼。最後又翻了一些文章,發現在PHP檔案中加入header("Content-type:
Time of Update: 2016-07-29
在windows環境下使用sublime開發,本地Apache伺服器進行調試,利用sublime的sftp外掛程式同步上傳至linux伺服器,出現windows下網頁預覽正常,遠程linux頁面部分顯示不正常,頁面中部分代碼未經yii架構解析,直接在以HTML格式原樣輸出解決辦法:1.使用var_dump()查看出錯頁面,檢查變數是否存在2.若不存在,則根據頁面提示的錯誤資訊,逐個解決存在問題的PHP檔案3.使用sftp同步開發時,是否將某些目錄的代碼禁止同步?導致本地yii架構檔
Time of Update: 2016-07-29
As of 5.2, routes.php is by default already called in the context of a [‘middleware’=>’web’] by RouteServiceProvider. But in routes.php default generation of auth routes, the Route::group call is still happening by default - so if you delete that