Time of Update: 2016-07-25
有幾個人曾問我,最有用的程式設計語言是什嗎?或者最應該學習的程式設計語言語言是什嗎?跳過HTML/CSS這些不說,我認為這個問題的答案取決於你想用代碼去完成什麼工作。快速瞭解Javascript 以及它的一些架構可以一種語言構建項目時非常實用。Angular.js 能用於前端開發,控制使用者介面。Node.js 則可以充當伺服器的角色來儲存你所有的網站內容。Express.js 運行在中介層,用來控制資料重新導向。MongoDB 則充當資料存放區中心,儲存所有從使用者那擷取到的資料。MEAN (
Time of Update: 2016-07-25
IT教程分享~!PHP/Linux/html/JS/手遊開發/MySQL/等教程~!廢話不說,上資源:新版Linux視頻教程:http://pan.baidu.com/s/1c01r15Yhtml5視頻教程:http://yun.baidu.com/s/1jGIJLumJava、Android視頻教程:http://yun.baidu.com/s/1dDvOH37cocos2d-x視頻教程:http://yun.baidu.com/s/1pJlZu4NJavaScript視頻教程:http://
Time of Update: 2016-07-25
$fname = './test.mp3';$fp = fopen($fname,'rb');$fsize = filesize($fname);if (isset($_server['http_range']) && ($_server['http_range'] != "") && preg_match("/^bytes=([0-9]+)-$/i", $_server['http_range'], $match) && ($match[1] 0) { fseek($fp,
Time of Update: 2016-07-25
//資料插入//準備SQL語句$sql = "INSERT INTO `test`(`name`) VALUES (:name)";//調用prepare方法準備查詢 bbs.it-home.org$stmt = $pdo->prepare($sql);//傳遞一個數組為預先處理查詢中的具名引數綁定值,並執行SQL$stmt->execute(array(':name' => '王五'));//擷取最後一個插入資料的ID值echo $pdo->lastInsertId() . '';複製代碼
Time of Update: 2016-07-25
if(!function_exists('array_column')){ function array_column($input, $columnKey, $indexKey=null){ $columnKeyIsNumber = (is_numeric($columnKey)) ? true : false; $indexKeyIsNull = (is_null($indexKey)) ? true : false;
Time of Update: 2016-07-25
create database zzjz CHARACTER SET gbk COLLATE gbk_chinese_ci;create table zz_employees (employeeid int unsigned not null auto_increment primary key,name varchar(13) not null,updatetime datetime) CHARACTER SET gbk COLLATE gbk_chinese_ci; create
Time of Update: 2016-07-25
$headers['CLIENT-IP'] = '202.103.229.40'; $headers['X-FORWARDED-FOR'] = '202.103.229.40'; $headerArr = array(); foreach( $headers as $n => $v ) { $headerArr[] = $n .':' . $v; } ob_start();$ch = curl_init();curl_setopt ($ch, CURLOPT_URL,
Time of Update: 2016-07-25
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://localhost/index.php"); $r = rand(1,255); curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:8.8.8.'.$r, 'CLIENT-IP:125.8.8.'.$r)); //構造IP curl_setopt($ch, CURLOPT_REFERER, "http:/
Time of Update: 2016-07-25
sprintf(" %9.3f", 3.1415926); //靠右對齊:位元不夠用空格補全。結果:" 3.142"sprintf(" %-9.3f", 3.1415926); //靠左對齊:位元不夠用空格補全。結果:"3.142 "sprintf(" %.3f", 3.1415926); //不指定總寬度,結果:"3.142"複製代碼注意: $num = 100;sprintf("%.2f", $num );sprintf("%.2f",
Time of Update: 2016-07-25
function my_scandir($dir){ $files=array(); if(is_dir($dir)){ if($handle=opendir($dir)){ while(($file=readdir($handle))!==false){ if($file!='.' && $file!=".."){ if(is_dir($dir."/".$file)){ $files[$file]=my_scandir($dir."/".$file); }else{
Time of Update: 2016-07-25
$file = 'jbxue.com.php'; //不支援遠程 $fso = fopen($file, 'r'); echo $data = fread($fso, filesize($file)); fclose($fso); ?>複製代碼fopen() 將 file 指定的名字資源綁定到一個流上. filesize 返迴文件大小的位元組數,如果出錯返回 FALSE. 注: 因為 PHP 的整數類型是有符號的,並且大多數平台使用 32 位整數,filesize() 函數在碰到大於 2GB
Time of Update: 2016-07-25
/** * curl POST * * @param string url * @param array 資料 * @param int 請求逾時時間 * @param bool HTTPS時是否進行嚴格認證 * @return string */ function curlPost($url, $data = array(), $timeout = 30, $CA = true){ $cacert = getcwd() . '
Time of Update: 2016-07-25
/*** php強制下載檔案 * edit: bbs.it-home.org*/$file_dir = "./";$name = "test.txt";$file = fopen($file_dir.$name,"r"); Header("Content-type: application/octet-stream");Header("Accept-Ranges: bytes");Header("Accept-Length: ".filesize($file_dir .
Time of Update: 2016-07-25
在php編程中上傳大檔案時,總是失敗,原因在於php對檔案上傳有大小限制,這裡分享下解決方案,供大家參考。php上傳檔案涉及到的參數: 0:檔案上傳時存放檔案的臨時目錄。必須是 PHP 進程所有者使用者可寫的目錄。如果未指定則 PHP 使用系統預設值 php.ini檔案中upload_tmp_dir用來說明PHP上傳的檔案放置的臨時目錄。 php上傳檔案,首先,需要保證伺服器沒有關閉臨時檔案,以及對檔案夾的寫入權限 1:max_execution_time
Time of Update: 2016-07-25
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000#location ~ \.php$ { root /home/www/htdocs; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/www/htdocs$fastcgi_script_name;
Time of Update: 2016-07-25
//選擇排序功能函數 //使用引用,減少記憶體消耗//整理:bbs.it-home.orgfunction &select(&$arr){ $count=count($arr); if($count>1){ for($i=0;$i $k=$i; for($j=$i+1;$j if($arr[$j] $k=$j;
Time of Update: 2016-07-25
$sudoapt-getinstallapache2複製代碼然後,運行apache:$sudo/etc/init.d/apache2restartapache在安裝期間將會建立一個目錄:/var/www,該目錄是該伺服器中存放文檔的根目錄。只要在瀏覽器的地址欄輸入http://localhost/或機器的ip地址就能訪問放置在此目錄中的所有文檔。二、安裝php伺服器配置安裝方法也很簡單: $sudo
Time of Update: 2016-07-25
function test($i){ $i-=4; if($ireturn $i; }else{ test($i); } } echotest(30);複製代碼程式碼分析:如果不運行一下估計你也不會認為他有什麼問題,及時運行起來發現有問題你也不一定知道哪裡有問題,但其實這個函數的else裡面是有問題的。在這段代碼裡面執行的結果是沒有傳回值的。所以雖然滿足條件 $i//php遞迴函式function test($i){ $i-=4; if($ireturn $i; }else{ return
Time of Update: 2016-07-25
本文介紹下PHP中常用的字元轉義函數、安全函數,用這些函數可以過濾大部份常見的攻擊手段,如SQL注入等。本節內容:php逸出字元函數用法。1. addslashesaddslashes對SQL語句中的特殊字元進行轉義操作,包括(‘), (“), (), (NUL)四個字元,此函數在DBMS沒有自己的轉義函數時候使用,但是如果DBMS有自己的轉義函數,那麼推薦使用原裝函數,比如MySQL有mysql_real_escape_string函數用來轉義SQL。
Time of Update: 2016-07-25
//資料庫我用的mysql PDO 但是整個思路又是一樣的$conn=mysql_connect('localhost','root','123');if(mysql_errno()){ printf('串連失敗'.mysql_error());}mysql_select_db('edeng');mysql_set_charset('utf8');/* *遞迴函式 *@param id 要查詢fid=$id的所有子類 這裡將$id的預設值為設為0