Time of Update: 2016-07-28
1、安裝環境 CentOS 6.5 Nginx1.10.1 a) 開啟 /etc/yum.repos.d/nginx.repo檔案, 添加 [nginx] name=nginx repo baseurl=http://nginx.org/packages/mainline/OS/OSRELEASE/$basearch/ gpgcheck=0 enabled=1 引用地址:http://nginx.org/en/linux_packages.
Time of Update: 2016-07-28
laravel架構學習之圖形驗證碼的使用下個圖形驗證碼的組件 composer require gregwar/captcha=1.*在控制器中use Gregwar\Captcha\CaptchaBuilder;public function xxx(Request $request){ $builder = new CaptchaBuilder; $builder->build(); $bb = $builder->
Time of Update: 2016-07-28
1、修改hosts檔案[root@slave html]# vi /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.0.203 www.wolf.com bbs.wolf.com
Time of Update: 2016-07-28
首先我排除不為整數訂單金額,因為面試官只給了7分鐘。mou(99);//這裡調用下面方法function mou($x){$array = array{50,40,30,20,1};$temp = 0 ;$j = $x ;for($i=0;${$temp = $temp+foor($j/$array[$i]);$j = $j%$array[$i];}echo "一共需要". $temp."張優惠卷";return
Time of Update: 2016-07-28
PHP分頁代碼在各種程式開發中都是必須要用到的,在網站開發中更是必選的一項。要想寫出分頁代碼,首先你要理解SQL查詢語句:select * from goods limit 2,7。PHP分頁代碼核心就是圍繞這條語句展開的,SQL語句說明:查詢goods資料表從第2條資料開始取出7條資料。在分頁代碼中,7表示每頁顯示多少條內容,2通過公式計算表示翻頁數,通過傳入不同參數替換“2”的值,即可篩選出不同的資料。index.php:include 'conn.php'; //引入資料庫操作類
Time of Update: 2016-07-28
PHP電商購物車———封裝資料庫操作類 建立了資料庫後,我們還是封裝一個資料庫的操作類吧(參考自付老師寫的那個Mypdo,本文後再附加一篇PDO總結在學習總結模組)。 if(file_exists(_DIR_.'db.ini')){ $ini = parse_ini_file('db.ini'); $dsn = $ini['db']
Time of Update: 2016-07-28
首先,你需要去有道翻譯API官網去申請key:http://fanyi.youdao.com/openapi?path=data-mode得到key之後,就可以開始從該API獲得查詢的資料了(返回json還是XML,看個人喜好,這裡我用的是json) 下面我直接把responseMsg方法裡,實現翻譯的代碼給出。如果你第一次接觸API,不懂這個方法是幹什麼的,請去點擊PHP開發之文本自動回複 public function responseMsg(){ //get post
Time of Update: 2016-07-28
在不需要瞭解內部實現的前提下,遍曆一個彙總對象的內部元素而又不暴露該對象的內部表示,這就是PHP迭代器模式的定義。適用情境:訪問一個彙總對象的內容而無需暴露它的內部表示支援對彙總對象的多種遍曆為遍曆不同的彙總結構提供一個統一的介面迭代器模式執行個體:arr = $arr; } function rewind(){ $this->position = 0; } function current(){ return $this->arr[$this->position]; } function
Time of Update: 2016-07-28
先看看基本區別:i++ :先在i所在的運算式中使用i的當前值,後讓i加1++i :讓i先加1,然後在i所在的運算式中使用i的新值看一些視頻教程裡面寫for迴圈的時候都是寫 ++i 而不是 i++,上網搜尋了一下,原來有效率問題++i相當於下列代碼i += 1; return i; i++相當於下列代碼j = i; i += 1; return j;當然如果編譯器會將這些差別都最佳化掉,那麼效率就都差不多了。再給大家詳細說下++i 與 i++ 的區別1、++i 的用法(以 a=++i ,i=2
Time of Update: 2016-07-28
#user nobody;worker_processes 1;#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#error_log /usr/local/var/log/nginx/error.log warn;#pid logs/nginx.pid;#pid /usr/local/var/run/nginx.pid;events
Time of Update: 2016-07-28
由於結果快充滿一頁了,所以先記錄下吧~! First Php三好少年';//11/* * 1,echo沒有傳回值,可以輸出多個字串,逗號隔開~ * 2,Print總返回1,只能輸出一個字串~ * 3,單引號只能輸出字串,雙引號能輸出變數~ * 4,var_dump這個犀利啊,能監測變數類型,並輸出值. * 5,數組元素可以不同類型,這個文法也是沒誰了.*/$cars = array("Volvo","BMW","TOYOTA",5);echo "字串1","字串2",
Time of Update: 2016-07-28
functionlogging() {var x = new XMLHttpRequest(); x.onreadystatechange =function() {if(x.readyState == 4) { if(x.status == 200) { console.log("The server replied with:
Time of Update: 2016-07-28
'1.1-4.6','1' => '1.2-33.7','2' => '1.3','3' => '1.4-30','4' => '15-44','5' => '1.1-4.6','6' => '1.2-33.7','7' => '1.3','8'
Time of Update: 2016-07-28
Thinkphp的curd操作的返回值1. Creat:add()增加資料成功返回:當主鍵是自增時,返回的是剛增加的主鍵,其他則返回1失敗返回:當資料非法時,返回的是false2.
Time of Update: 2016-07-28
今天弄圖片儲存時,用到file_put_contents()來儲存圖片,運行了幾次,發下一直沒有資料出來,以為是這個函數沒操作成功於是查看了下這個函數的用法和傳回值,發現我輸出的返回都正確,後來才發現是其他原因引起的現在分享下這個函數的用法:file_put_contents() 函數是一次性向檔案寫入字串或追加字串內容的最合適選擇。 file_put_contents() 函數用於把字串寫入檔案,成功返回寫入到檔案內資料的位元組數,失敗則返回 FALSE。 文法: int
Time of Update: 2016-07-28
直接使用php函數 json_encode ,資料存入mysql時會報錯:Php代碼 $imgs_str = json_encode($imgs_array); $imgs_str = addslashes($imgs_str); $update_query = "updatearticleset imageList = $imgs_str where id = $targetid"; 解決方案json編碼後的資料是這樣的:Js代碼 {"key":"value"}
Time of Update: 2016-07-28
html>head>meta charset="utf-8">title>title>head>body>php $con = mysqli_connect("localhost", "root", "root","ehr"); if (!$con) { //轉碼 echo 'Could not connect: ' . iconv('gbk', 'utf-8',
Time of Update: 2016-07-28
前提: 關於 openresty 或者 ngx_lua 請參考:http://openresty.org/en/問題:
Time of Update: 2016-07-28
由於nginx依賴於pcre和zlib,所以在安裝nginx時,需要先安裝pcre和zlib(為了方便起見,我把pcre、zlib、nginx的包放到了同一個目錄下)。1、安裝pcre從pcre的官網下載tar.gz包,官網地址為:ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/,在這裡我下載的是:pcre-8.39.tar.gztar -zxvf pcre-8.39.tar.gzcd pcre-8.39./configure
Time of Update: 2016-07-28
$url="www.baidu.com"; //網域名稱$path="/"; //路徑$type="GET"; //要求方法error_reporting(E_ALL);echo "TCP/IP Connection\n";/* 擷取連接埠號碼 */$service_port = getservbyname('www', 'tcp');/* 擷取ip地址. */$address = gethostbyname($url);/* 建立 TCP/IP socket. */$socket =