Time of Update: 2016-07-29
/** * Created by PhpStorm. * User: * Date: 2016/4/20 * Time: 20:07 */session_start();//畫一張背景圖$image=imagecreatetruecolor(100,30);$bgcolor=imagecolorallocate($image,255,255,255);imagefill($image,0,0,$bgcolor);/*//產生四位隨機數字 for($i=0;$i $f $
Time of Update: 2016-07-29
php7編譯安裝redis擴充background: 最近將php升級到7.0 需要用到redis擴充, sudo apt-get install php7-redis 沒找到 只能編譯安裝 編譯安裝流程如下1 下載解壓源碼包cd ~/downloadwget -c https://github.com/phpredis/phpredis/archive/php7.zipunzip php7.zip2 產生 .configure設定檔cd phpredis-php7phpize#
Time of Update: 2016-07-29
1.Xdebug介紹 Xdebug是一個開放原始碼的PHP程式調試器(即一個Debug工具),可以用來跟蹤,調試和分析PHP程式的健全狀態。2.Xdebug安裝及配置1、下載Xdebug組件到Xdebug官方網站 www.xdebug.org下載相對應的PHP版本的xdebug組件。如果你用的是 wamp ,則已經整合到裡面了,可以用 phpinfo() 進行查看 Xdebug是否已經安裝。查看Xdebug是否已經安裝2、在PHP.ini中載入xdebug組件Xdebug在 php.ini
Time of Update: 2016-07-29
Atitit php序列化 php的serialize序列化和json序列化 PHP 對不同類型的資料用不同的字母進行標示,Yahoo 開發網站提供的Using Serialized PHP withYahoo! Web Services 一文中給出所有的字母標示及其含義:a - arrayb - booleand - doublei - integero - common objectr - references - stringC - custom objectO - classN -
Time of Update: 2016-07-29
php數組常用函數array_map ( callable callback,arrayarr1 [, array $… ] ) 返回一個數組,該數組包含了 arr1 中的所有單元經過 callback 作用過之後的單元。 callback 接受的參數數目應該和傳遞給 array_map() 函數的數組數目一致。 /*例1*/functioncube( $n ){return( $n * $n * $n );} $a = array( 1 , 2 , 3 , 4
Time of Update: 2016-07-29
最近一段時間會學習一下PHP全棧開發,將會寫一系列的文章來總結學習的過程,以自勉。第一篇記錄一下LAMP環境的安裝0、 安裝Apache Web伺服器安裝之前先更新一下系統sudo apt-get update && sudo apt-get dist-upgrade然後安裝Apachesudo apt-get install apache2這時在瀏覽器裡輸入localhost就可以看到 "It works!", 說明安裝成功。1、 安裝MySQL資料庫sudo apt-get install
Time of Update: 2016-07-29
在php的物件導向編程中,總會遇到class test{ public static function test(){ self::func(); static::func(); } public static function func(){}}可你知道self和static的區別嗎?其實區別很簡單,只需要寫幾個demo就能懂:Demo for self:class Car{ public static function model(){ self::getModel(); }
Time of Update: 2016-07-29
1. 定義關聯模型在Laravel裡面,我們可以通過定義以下Model來完成關聯查詢。class MyPost extends Eloquent { public function myPostInfo () { return $this->hasOne('MyPostInfo'); }}class MyPostInfo extends Eloquent {}2.
Time of Update: 2016-07-29
server {listen 80;listen 443 ssl;server_name treephp.yioio.com;fastcgi_max_temp_file_size 0;charset utf-8;access_log /yioio/Logs/nginx/treephp.yioio.com.log;location ~* ^.+\.(js|css|json|map|html|jpg|jpeg|gif|png|svg|ico)$ {root /yioio/code/treephp;}
Time of Update: 2016-07-29
這篇文章主要介紹了PHP動態地建立屬性和方法, 對象的複製, 對象的比較, 載入指定的檔案, 自動載入類檔案, 命名空間 的相關資料,需要的朋友可以參考下PHP前言:•動態地建立屬性和方法•對象的複製•對象的比較•載入指定的檔案•自動載入類檔案•命名空間樣本1、類的相關知識點 3(動態地建立屬性和方法)class/class3.php<?php/*** 類的相關知識點 3(動態地建立屬性和方法)*/// 用於示範如何動態地建立屬性(這就是 php 中所謂的重載)class Class1{/
Time of Update: 2016-07-29
PHP檔案名稱:dome.php$string = 1; ob_start(); @readfile("templets/list.html"); $text = ob_get_flush(); $myfile = fopen("list.html","w"); $text = str_replace ("{counent}",$string,$text); fwrite($myfile,$text);
Time of Update: 2016-07-29
/** *PHP頁面靜態化分為以下步驟: *1.開啟輸出控制緩衝 *2.返回輸出緩衝區的內容 *3.將一個字串寫入檔案 *4.沖刷出緩衝區的內容 *///1.開啟輸出控制緩衝ob_start();?>php頁面靜態化php頁面靜態化//2.返回輸出緩衝區的內容$contents = ob_get_contents();//3.將一個字串寫入檔案file_put_contents("newindex.html",$contents);//4.沖刷出緩衝區的內容ob_flush();?>
Time of Update: 2016-07-29
配置完nginx,訪問tomcat時發現,tomcat顯示如:從這個狀態可以看出,猜測可能是css和js這些檔案沒有載入。不僅如此,訪問部署在tomcat項目的頁面也是一樣的,不同nginx訪問tomcat下的項目時這樣的:通過nginx作為Proxy
Time of Update: 2016-07-29
本文執行個體講述了joomla實現註冊使用者添加新欄位的方法。分享給大家供大家參考,具體如下:joomla原來的註冊很簡單,為了添加自己想要的欄位,比如電話。在資料庫添加這一欄位“telphone"修改libraries\joomla\database\table\user.php在JTableUser這個類添加新的變數:var $telphone =
Time of Update: 2016-07-29
定義Show類類中定義方法 sum方法中傳入兩個數在方法體內部求出兩個數之間所有偶數得和將求出得結果返回 輸出返回後的結果輸出形式如下兩個數之間所有偶數得和為: 30注意判斷:傳入得兩個數較小得數第一個傳入 較大得數第二個傳入 兩個數不能相等。代碼如下:$two){for ($i=$two; $i $one){for ($i=$one; $i sum(20,30);//輸入兩個數值
Time of Update: 2016-07-29
1. bool function_exists ( string $function_name )在已經定義的函數列表(包括系統內建的函數和使用者自訂的函數)中尋找 function_name。返回:如果一個函數已經定義,返回true對於文法結構的查詢,返回false2.bool imagefilter ( resource srcim,intfiltertype [, int arg1[,intarg2 [, int $arg3 ]]] ) 對映像使用過濾器php5,7imagefilter(
Time of Update: 2016-07-29
0){ $uploadfile = "./".time()."_".$_FILES['userfile']['name']; if (copy($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "OK"; //文字浮水印 //
Time of Update: 2016-07-29
具體的配置和tomcat下的一樣,具體請參考:http://note.youdao.com/share/?id=e486a2e17eefbfab6f227dc9dddd0cef&type=note下面是一些備忘:一、tomcat叢集和負載平衡的實現(session同步)補充因 為tomcat的session同步功能需要用到組播,windows預設情況下是開通組播服務的,但是linux預設情況下並沒有開通。可以通過指令打 開route add -net 224.0.0.0 netmask 240.
Time of Update: 2016-07-29
1.sudo vim /Applications/XAMPP/xamppfiles/etc/httpd.conf 2.找到 AllowOverride none Require all denied3.改為 AllowOverride none Require all granted所有訪問都有效,降低了系統的安全性。預設是拒絕的。另外更好的方法可以百度。這個東西害我弄了兩天原來是它預設的有問題。如有更好解決辦法請告訴本人
Time of Update: 2016-07-29
展示的是 PHP 不同版本的效能測試,用的是 bench.php 這個測試指令碼(這個指令碼從 PHP 5.1 開始就有了)。縱座標是完成測試的時間,所以數字越小,成績越好。測試的大致步驟:擷取從 PHP 5.1 到 5.4 各個版本最新的代碼使用最基本的預設配置進行編譯,不加任何擴充運行 bench.php 10遍並收集資料取平均值,並且使用 Google Chart 展示未經處理資料如下:所以你可以看到的是,PHP 5.4 比之前的版本有明顯的效能提升,還不升級嗎?PHP