Time of Update: 2016-07-25
session_start ();header ( 'Content-type: image/png' );//建立圖片$im = imagecreate($x=130,$y=45 );$bg = imagecolorallocate($im,rand(50,200),rand(0,155),rand(0,155)); //第一次對 imagecolorallocate() 的調用會給基於調色盤的映像填充背景色$fontColor = imageColorAllocate ( $im, 255,
Time of Update: 2016-07-25
/** * 全形字元轉換為半形字元 */function make_semiangle ( $str ){$arr = array ( '0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', 'A' => 'A', 'B' => 'B', 'C' => 'C'
Time of Update: 2016-07-25
PHP7 2015-12月正式發布,效能比5.6版本提高了不少,因此安裝php7試試,在php.ini 配置zend_extension=opcache.soopcache.enable=1opcache.enable_cli=1果然效能提高了很多。 #!/bin/bashapt-get updateapt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev
Time of Update: 2016-07-25
class runtime{ var $StartTime = 0; var $StopTime = 0; function get_microtime() { list($usec, $sec) = explode(' ', microtime()); return ((float)$usec + (float)$sec); } function start() {
Time of Update: 2016-07-25
function get_links($link) { $html = file_get_contents($link); $html = str_replace("\n", "", $html); $html = preg_replace('/ $html = preg_replace('//', "\n", $html); preg_match_all('/.*?/', $html, $matches); return($matches);}複製代碼
Time of Update: 2016-07-25
課課家今天跟大家分享的是如何學習PHP底層的運行機制與原理,PHP是一種適用於web開發的動態語言。具體點說,就是一個用C語言實現包含大量組件的軟體架構。更狹義點看,可以把它認為是一個強大的UI架構。 AD: PHP說簡單,但是要精通也不是一件簡單的事。我們除了會使用之外,還得知道它底層的工作原理。 PHP是一種適用於web開發的動態語言。具體點說,就是一個用C語言實現包含大量組件的軟體架構。更狹義點看,可以把它認為是一個強大的UI架構。 瞭解PHP底層實現的目的是什麼?動態語言要像用好
Time of Update: 2016-07-25
代碼描述:基於php的加油卡儲值介面調用代碼執行個體關聯資料:加油卡儲值介面地址:http://www.juhe.cn/docs/api/id/87 // +----------------------------------------------------------------------// | JuhePHP [ NO ZUO NO DIE ]// +----------------------------------------------------
Time of Update: 2016-07-25
php中的強制類型轉換一般出現在算術運算子參與的環境中,算術運算子是比較常見的數字操作符,被操的內容我們一般稱之為運算對象或運算元。算術運算子通常用於整形或雙精確度(又稱為浮點或實數)類型的資料。如果參與算術運算的對象中有字串,php會試圖將這些字串轉換成一個數字。如果其中包含“e”或“E”字元,它就會被當做是科學標記法並被轉換成浮點數,否則將會被轉換成整數。php會在字串開始處尋找數字,並且使用這些數字作為該字串的值,如果沒有找到數字,該字串的值為0。php
Time of Update: 2016-07-25
理解變數的範圍範圍是指在一個指令碼中某個變數可以使用或可見的範圍。PHP具有6項基本的範圍規則:內建超級全域變數可以在指令碼的任何地方使用和可見。常量,一旦被聲明,將可以在全域可見;也就是說,它們可以在函數內外使用。在一個指令碼中聲明的全域變數在整個指令碼中是可見的,但不是在函數內部。函數內部使用的變數聲明為全域變數時,其名稱要與全域變數名稱一致。在函數內部建立並被聲明為靜態變數無法在函數外部可見,但是可以在函數的多次執行過程中保持該值在函數內部建立的變數對函數來說是本地的,而當函數終止時,該變
Time of Update: 2016-07-25
自訂 php 錯誤捕獲代碼, register_shutdown_function(), set_error_handler() /** * @Author: yangyulong * @Date: 2015-12-28 22:09:22 * @Last Modified by: yangyulong * @Last Modified time: 2015-12-28 22:48:49
Time of Update: 2016-07-25
php date mktime strtotime 擷取時間方法 /** * 獲得系統年份數組 */function getSystemYearArr(){ $year_arr = array('2010'=>'2010','2011'=>'2011','2012'=>'2012','2014'=>'2014','2014'=>'2014','2015'=>'2015','2016'=>'2016','2017'=>'2017','2018'=>'2018','
Time of Update: 2016-07-25
使用類型轉換,可以將一個變數的值轉換成另一種類型。這種轉換與c語言的類型轉換是相同的。只需在希望進行類型轉換的變數之前的圓括弧中插入需要轉換的臨時資料類型即可。例如:$totalqty = 0;$totalamount =
Time of Update: 2016-07-25
if(運算式):?> 語句endif?>複製代碼以上寫法是php的流程式控制制的替代文法。PHP 流程式控制制中有以下幾種替代文法:if,while,forforeach,switch替代文法的基本形式是:用冒號(:)替換流程式控制制語句中的左邊的開始的花括弧({),而右側的結尾的花括弧(})可以使用endif或endwhile或endfor或endforeach甚至endswitch替換。endif
Time of Update: 2016-07-25
gettype-擷取變數類型文法:string gettype (mixed $var)返回的字串的可能值為:booleanintegerdoublestringarrayobjectresourcenullunknown type注意:不要使用gettype()
Time of Update: 2016-07-25
在php開發中,php如何?html word互轉的呢?有什麼方法嗎?下面就給大家介紹php將html轉入word中的方法,這是經過測試的,這種方法有一點不好,html頁面代碼要寫在php中,不過好歹能運行,看程式'; }function save($path){echo "";$data = ob_get_contents();}function wirtefile($fn,$data){$fp=fopen($fp,$data);fwrite($fp,$data);}}$html=' 姓名
Time of Update: 2016-07-25
如何才能正確的實現php抓取網頁內容呢?這個問題對於接觸PHP語言不久的朋友來說有些難辦。課課家今天就為大家介紹了具體的解決辦法。 首先,在C\windows裡的php.ini中我開啟了extension=php_curl.dll的功能,然後也重啟了apapche,以下是我寫的PHP抓取網頁內容之抓取百度中PHP的資訊: //初始化curl $ch = curl_init() or die (curl_error()); echo
Time of Update: 2016-07-25
class emp{ var $name; var $address; var $dept; function assign_info($n,$a,$d) { $this->name=$n; $this->state=$a; $this->dept=$d; } function display_info() { echo("Employee Name : $this->name"); echo("State : $
Time of Update: 2016-07-25
function dirSize($directoty){ $dir_size=0; if($dir_handle=@opendir($directoty)) { while($filename=readdir($dir_handle)){ $subFile=$directoty.DIRECTORY_SEPARATOR.$filename; if($filename=='.
Time of Update: 2016-07-25
/** * “抽獎”函數 * * @param integer $first 起始編號 * @param integer $last 結束編號 * @param integer $total 獲獎人數 * * @return string **/function isWinner($first, $last, $total){ $winner = array(); for ($i=0;;$i++) { $number =
Time of Update: 2016-07-25
$exec = shell_exec('uptime'); $uptime = explode(' up ', $exec); $uptime = explode(',', $uptime[1]); if (strpos($uptime[0], 'day')) { $time = explode(':', $uptime[1]); echo('Current system uptime is ' . $uptime[0]. ', ' . $time[