Time of Update: 2016-07-29
今天在寫一個函數時,用到了一些零碎的小知識點,將它們以簡單例子的形式總結出來。$array=array(4,5,1,2,3,1,2,1);$ac=array_count_values($array);//數組中所有字元出現的次數print_r($ac);echo pow(2,1);//求2的1次方echo "\n";echo decbin(1);//將十進位1轉換為二進位echo "\n";$l=4;$o=0;echo $k=sprintf("%0{$l}d",
Time of Update: 2016-07-29
概述:實現 localhost/site/login 訪問 localhost/index.php?r=site/login1. web server 配置 a. nginx 配置 location / { try_files $uri $uri/ /index.php?$args; } b. apache 配置 DocumentRoot "webroot" RewriteEngine on # If a
Time of Update: 2016-07-29
privatefunctiongeturl($url) {$ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $file_contents =
Time of Update: 2016-07-29
jsonp 使用環境一般是在做不同域的登入或者資料交換時前台和後台交換可用原理:引入的js可以是不同域,js檔案可以從後台產生(這裡說的有點簡單,大家多去找找資料)使用DEMO:html://原生js //jQ版Insert title here1後台PHP: 以上就介紹了jsonp
Time of Update: 2016-07-29
本文執行個體講述了PHP基於單例模式實現的資料庫操作基類。分享給大家供大家參考,具體如下:設定檔:'localhost', 'user'=>'root', 'password'=>'', 'database'=>'test',)?>php 資料庫基類:conn = mysql_connect($db['host'],$db['user'],$db['password']);
Time of Update: 2016-07-29
index_uploads index_uploads.php"; print_r($_FILES); echo ""; $count = count($_FILES['file']['name']); for ($i = 0; $i
Time of Update: 2016-07-29
先安照路徑放好。簡單使用無logo:public function qrcode(){ Vendor('phpqrcode.phpqrcode'); //產生二維碼圖片 $object = new \QRcode(); $url='http://www.shouce.ren/';//網址或者是常值內容 $level=3; $size=4; $errorCorrectionLevel =intval(
Time of Update: 2016-07-29
三個角色用戶端Proxy 伺服器目標伺服器正向 Proxy目標伺服器對用戶端是可見的(無論Proxy 伺服器是否存在),只是可能存在用戶端必須要經過Proxy 伺服器才能訪問目標伺服器的可能(比如訪問www.google.com)反向 Proxy目標伺服器對用戶端不可見,用戶端只能通過Proxy 伺服器才能訪問目標伺服器,用戶端根本不知道Proxy 伺服器後端有哪些目標伺服器。圖例上面:正向 Proxy 下面:反向 Proxy ').addClass('pre-numbering').hide(
Time of Update: 2016-07-29
如果你的Form表單中的屬性有部分不是在資料庫中,而你的Mode又整合了ActiveRecord,這時想通過$model->load()載入那部分未在資料庫定義的屬性可以重寫attributes()函數,例如:/** * * {@inheritDoc} * * @see \common\db\ActiveRecord::attributes() */public function attributes (){$attributes =
Time of Update: 2016-07-29
表單元素名稱:開關調用基本格式:{input type='switch' model=$model field='is_parent' value='1' uncheck='0' items=[0='否, '1'=>'是']}
Time of Update: 2016-07-29
我寫的原代碼如下:function the_lan_ip() {//if (!is_windows_os()) { //如果不是windows作業系統,執行ifconfig,去捉相應的IPv4的IPexec('ifconfig', $output);for ($i = 0; $i error_reporting(0);preg_match('/\inet.*:(.*)\040/', $output[$i], $the_ip_str);
Time of Update: 2016-07-29
聊天邏輯的好多細節沒有實現,只實現群發。php代碼:$serv = new swoole_websocket_server("127.0.0.1",3999);//服務的基本設定$serv->set(array('worker_num' => 2,'reactor_num'=>8,'task_worker_num'=>1,'dispatch_mode' => 2,'debug_mode'=> 1,'daemonize' => true,'log_file' =>
Time of Update: 2016-07-29
前端程式員:月薪 5K 到 5 萬,我幹了啥如何在前端開發這種高精尖的技術領域找到心儀的工作?實現在咖啡館喝喝咖啡敲敲代碼就能升職加薪、買房買車、迎娶白富美走上人生巔峰的職業夢想?這篇《進化論:從 0 到 100,前端猿茁壯成長的精神飼料史》,肯定能給你事業的加速動力。前端開發工作已經變的越來越複雜,僅僅是想羅列一份前端開發的學習列表就已經是一件艱巨的工作。曾經只要會編寫 HTML,CSS 和Javascript 就是能夠找到一份前端開發工作的全部要求。而現在,web
Time of Update: 2016-07-29
微軟全新作業系統Windows10在190個國家和地區正式同步上市,正版Windows7、Windows8.1使用者均可在一年內免費升級。介紹一下在升級後的Windwos10系統上安裝及配置Apache及PHP步驟(感覺和Windows7、8沒有差別)。首先下載符合系統位元的Apache和PHPhttp://www.apachelounge.com/download/http://windows.php.net/download安裝並配置ApacheApache版本:Apache2.4.18解壓
Time of Update: 2016-07-29
1.strstr(string,str); //判斷是否存在,如果存在,則返回string2.stristr(string,str); //和1一樣,區別大小寫3.strpos(string,a) !== false //表示存在,效率略高於1,2').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering);
Time of Update: 2016-07-29
概述使用PHP的array_unique()函數允許你傳遞一個數組,然後移除重複的值,返回一個擁有唯一值的數組。這個函數大多數情況下都能工作得很好。但是,如果你嘗試在一個大的數組裡使用array_unique()函數,它會運行地慢一些。有一個比較好而且更快的函數array_flip()來替代使用array_unique()函數來建立唯一的數組。這個魔法般的函數會交換數組裡面每一個元素的鍵和值,因為索引值必須唯一,因此,你會得到跟array_unique()函數一樣的結果。更快的方式實現PHP數組
Time of Update: 2016-07-29
本文執行個體分析了PHP的mysql事務問題。分享給大家供大家參考,具體如下:對於myisam資料庫,可以控制事務的進行:$mysqlrl = mysql_connect ( $db_config ["host"], $db_config ["user"], $db_config ["pass"], true );if (! $mysqlrl) { $msg = mysql_error (); die ( 'Could not connect: ' . $msg
Time of Update: 2016-07-29
今天看TP 的session 實現,主要學到了以下php中的函數,特此記錄!/*** 主要使用到的php 中的方法* is_array : 判斷是否為數組* isset : 判斷變數是否設定* -->1.變數不存在 false* -->2.變數存在但值為空白 false* -->3.變數存在且值不為空白 true* 注意: a.檢查多項時,每一項都符合上述條件才返回true*
Time of Update: 2016-07-29
因為前兩天某項目需要PHP串連MySql,雖然以前學過,但是現在基本也忘得一乾二淨了,不過後來尋找大量資料找到了方法:php //設定字元集header('Content-Type: text/html; charset=utf8'); //串連資料庫$link = mysql_connect("localhost","root","123456"); if(!$link){ echo '資料庫連接失敗...'; exit(-1);
Time of Update: 2016-07-29
功能說明:1.後台校正:驗證時如果值為空白則賦值預設值。2.前台校正:滑鼠失去焦點時進行校正;如果存在非空(required)校正則先進行非空驗證,如果無非空驗證則在滑鼠失去焦點後自動填滿預設值。使用方式:// 在rules()函數中調用$rules[] = Model::addRule('cat_sort', 'default', ['value' =>