Time of Update: 2018-12-07
<?php/*** create by :xiaojiang* PHP log 類 日誌入庫功能 僅供交流學習*/class Config{ public static function getConfig (){ return array( 'LOG_LEVEL'=>75 //INFO ); }}class Log{ private $LogFile; private $logLevel; const
Time of Update: 2018-12-07
先看看官方文檔的解釋__set() is run when writing data to inaccessible properties.__get() is utilized for reading data from inaccessible properties.究竟用中文怎麼翻譯呢? inaccessible :n. 難達到;難接近;無法理解。有代碼有真相:<?phperror_reporting(E_ALL);class stu{private $a;private $b
Time of Update: 2018-12-07
View Code
Time of Update: 2018-12-07
1.boolean sort(array target_array [,int sort_flags]) :按數字和字母的順序排序2.boolean rsort(array target_array [,int sort_flags]) :以降序對數組元素進行排序3.void asort(array target_array [,int sort_flags]) :對關聯陣列排序(保留原來的索引關係)4.void arsort(array target_array [,int
Time of Update: 2018-12-07
注意:如$str="this is a book!";我們有$str[0]或$str{0}表示"t",以此類推的說法哈//去除空格和其他符號1. string trim(string str [ , string charlist] ) :兩邊去空格或其它字元2. string ltrim( string str [ , string charlist ]) :左邊去空格或其它字元 3. string rtrim( string str [ , string charlist] )
Time of Update: 2018-12-07
//----------POSIX風格的Regex//用於簡單的搜尋和匹配1.int ereg( string pattern , string str [ , array regs ]) :搜尋成功則返回正數,否則返回負數。該函數是區分大小寫2.int eregi( string pattern , string str [, array regs ]) :搜尋和匹配指定的Regex。它只是不區分大小寫,其他和ereg()函數是一致的//用於搜尋和替換3.string
Time of Update: 2018-12-07
<?php$url="http://www.otcmarkets.com/edgar/ajax/GetFilings.json";$keysArr = array( "symbol"=>"FSCND", "body"=>"[object HTMLDivElement]", "progressBarBody"=>"[object HTMLQuoteElement]", "progressBarOn"=>"true",
Time of Update: 2018-12-07
請注意使用writeImages()而不是writeImage() 1 <?php 2 try 3 { 4 // Read in the animated gif 5 $animation = new Imagick("animation.gif"); 6 7 // Loop through the frames 8 foreach ($animation as $frame) 9 {10 // Thumbnail
Time of Update: 2018-12-07
今天做一個應用本來想在php處理常式期間把資訊寫入session 在後台執行 然後前台通過ajax進行調用查看 發現無論如何調用都要等 程式完全執行完 才會出現結果。 百度了下 原來 PHP 的session 設定了鎖的功能。 (類似MYSQL鎖表) <?php session_start(); $_SESSION['test'] = 0; session_write_close(); // notice! sleep(5)
Time of Update: 2018-12-07
<?php/** +---------------------------------------------------------- * 分類樹 +---------------------------------------------------------- */function list_to_tree($list, $pk='id',$pid = 'pid',$child = '_child',$root=0){ // 建立Tree $tree = array(
Time of Update: 2018-12-07
<?php/** * @author:xiaojiang * PHP 實現var_export();功能 */ $arr = array("1","2","3"); $arr1 = array('a'=>NULL,'b'=>array('1'=>3)); var_export($arr); //var_export($arr1); function varExport($arr){ $ret = "array( ";
Time of Update: 2018-12-07
今天朋友群裡朋友問了下 按位與或的問題。。 PHP 工作有1年了 可能對這塊不太熟悉吧 在這裡給新手朋友介紹下這部分 按位於主要是對位元操作。 <?php$a = 1;$b = 2;$c = $a^b;echo $c // 3?> 這裡不是單純的相加關係 十進位 1換算成二進位 00000001 十進位 2換算成二進位 00000010 按位^ 00000011 //
Time of Update: 2018-12-07
在PHP中數組常被當作堆棧(後進先出:LIFO)與隊列(先進先出:FIFO)結構來使用。PHP提供了一組函數可以用於push與pop(堆棧)還有shift與unshift(隊列)來運算元組元素。堆棧與列隊在實踐中應用非常廣泛。我們可以先看下堆棧: <?php $arr = array(); array_push($arr,'aaa'); array_push($arr,'bbb'); $arr.pop(); print_r($arr);?>
Time of Update: 2018-12-07
介紹 PHP是一門非常令人驚奇的語言。它足夠強大(最大的部落格(wordpress)的核心語言),它足夠廣泛(運行在最大社交網站facebook上),它足夠簡單(作為初學者首選入門語言)。在低成本的機器上運行良好。而且php語言有很多非常不錯的伺服器套件(如WAMP和MAMP),很方便的安裝在你的機器上。PHP有非常豐富的庫資源,便於開發人員很容易的處理一些業務。由於我們在項目中與日期接觸最多,所以今天就從日期函數入手學習。 舉一個簡單的date例子 我將使用echo命令把內容輸出到我們的
Time of Update: 2018-12-07
<?php/* * @author : xiaojiang * @time : 2013-04-25 *///定義縮圖片尺寸$picSize = array( '100_100'=> 1, '200_100'=> 1 );$imagePath = "../image/";function parseUrl($url){ preg_match("/(?P<name>[\w\d]+)_w(?
Time of Update: 2018-12-07
介紹 今天發現php5.1.*和php5.2.*在資料庫先行編譯代碼執行的時候出現差異。 先行編譯優點1.使用預留位置,避免逐字輸入資料到SQL中。自動處理引號和反斜線等字元的轉義——增加安全性。2.預先“準備”一條語句,然後在每次執行時綁定不同值達到重用的目的。——常用於以後被多次執行的語句。3.可讀性強。 代碼資料庫連接代碼都一樣. $protol = 'mysql:host=localhost;dbname=test';$username = 'monty';$passwd = '0818
Time of Update: 2018-12-07
[PHP]engine = Onshort_open_tag = Onasp_tags = Onprecision = 14y2k_compliance = Onoutput_buffering = 4096zlib.output_compression = Offimplicit_flush = Offunserialize_callback_func =serialize_precision = 100allow_call_time_pass_reference =
Time of Update: 2018-12-07
近期在做一個基於LAMP體系的項目,在系統測試階段發現了Apache+PHP無法成功上傳大檔案的問題,於是百度、google一頓搜後,發現原來是PHP配置的原因。這裡記錄水文一篇,留作日後遇到類似問題參考使用,避免二次檢索做無用功。首先,需要根據允許上傳的最大檔案大小值(如32M),對php.ini中的如下參數進行配置:file_uploads = On ; Whether to allow HTTP file uploadsupload_max_filesize =
Time of Update: 2018-12-07
簡介:這是PHP array_multisort()的使用劄記的詳細頁面,介紹了和php,有關的知識、技巧、經驗,和一些php源碼等。 class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=339823' scrolling='no'>?函數 bool array_multisort ( array &$arr [, mixed $arg = SORT_ASC [,
Time of Update: 2018-12-07
簡介:這是php中的三元運算子的詳細頁面,介紹了和php,有關的知識、技巧、經驗,和一些php源碼等。 class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=339827' scrolling='no'>今天一個網友在群裡發了個題目不難,但是可能會錯echo $a == 1 ? 'one' : $a == 2 ? 'two' : $a == 3 ? 'three' :