PHP對檔案的一些操作

2021-08-07 18:59:37 字數 1205 閱讀 7498

alter table guitarwars drop column score;//從資料庫中刪除乙個列;add columu新增乙個新列;change column修改一列;modify columu;修改乙個資料表中某一列的資料型別或位置。

$_files//是內建的php超級全域性變數,通過它將一些有用的資訊傳遞到php指令碼。;$_files['screen']['name']//上傳檔案的檔名;$_files['screen']['type']//上傳檔案的型別;$_files['screen']['size']//上傳檔案的大小(位元組數)。;$_files['screen']['tmp_name']//檔案在伺服器上的臨時儲存位置。;$_files['screen']['error']//檔案上傳的錯誤碼;0表示成功,其他值表示失敗。;

資料庫非常擅長儲存文字資料,但是儲存諸如影象的原始二進位制資料則不是它的強項,所以最好知識在資料庫中儲存檔案的乙個引用。這個引用就是影象檔案的檔名。

//上傳檔案。上傳檔案以後這個檔案會**到伺服器上的乙個臨時資料夾中,這個臨時資料夾會在伺服器上自動建立,通常有乙個奇怪的名字,包含一堆隨機字母和數字。你沒辦法控制上傳檔案的儲存位置,檔案上傳後你可以把檔案移動到另乙個位置。move_uploaded_file()接受乙個檔案的源位置和目標位置,然後負責完成檔案移動。

move_uploaded_file($_files['screenshot']['tmp_name'],$target);

select * from guitarwars order by name asc;//查詢結果公升序排列,asc代表公升序(ascending),desc代表降序(descending)。

get和post之間的區別,post只能從表單發出,get可以打包為url。get和post最主要的差別在於請求的目的不同,get主要用於從伺服器獲得資料而不影響伺服器上的任何其他方面,post通常會向伺服器傳送資料,而且在此之後伺服器的狀態往往會有某種程度的改變來相應所傳送的資料。如在資料庫中插入資料,資料還可以相應中返回,不同與get,post請求只能通過web表單的動作完成。另外與get不同post請求中傳送的資料是隱藏不可見的。get主要適用於傳送少量資料。

delete from guitarwars where name='ashton simpson' and score='33333' limit 1;//刪除的時候多加幾個限制,尤其是最後乙個限制只刪除乙個。

我自己寫的小**www.caozhicong.com

對檔案的一些操作2

對檔案的一些操作2 author administrator date 2019 10 29 f open tx1 r encoding utf8 1 按照字元列印 print f.read 5 print f.read 5 print 有個自動換行 一剪梅 紅藕香殘 2 一行一行列印 print ...

c 中對檔案的一些操作

include include include using namespace std int main if outfile int a,b int i 0,j 0 int data 6 2 while myfile.eof myfile.close for int k 0 k outfile c...

python對檔案路徑的一些操作

import glob import os filename list sorted glob.glob r e vs code image png for i in filename list print file format i 檔名 filename os.path.basename i p...