DIỄN ĐÀN CÔNG NGHỆ THÔNG TIN TIÊN PHƯỚC-QUẢNG NAM
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.
Tìm kiếm
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Nội thất tam kỳ noithattamky.vn
Hàm xử lý file trong php(create file,create folder,write,delete file in PHP) I_icon_minitimeTue Mar 22, 2016 10:06 pm by thanhtruyen

» Bộ lưu điện santak - boluudiensantak.com
Hàm xử lý file trong php(create file,create folder,write,delete file in PHP) I_icon_minitimeWed Jan 27, 2016 6:59 am by thanhtruyen

» Barrier tự động đà nẵng, hồ chí minh
Hàm xử lý file trong php(create file,create folder,write,delete file in PHP) I_icon_minitimeSun Jan 03, 2016 4:17 pm by thanhtruyen

» BỘ DÀN KARAOKE YAMAHA KMS 962 CHƯA SỬ DỤNG
Hàm xử lý file trong php(create file,create folder,write,delete file in PHP) I_icon_minitimeWed Nov 11, 2015 10:41 pm by thanhtruyen

» TƯNG BỪNG KHUYẾN MÃI LẮP ĐẶT TRỌN GÓI CAMERA tai vn24s.com
Hàm xử lý file trong php(create file,create folder,write,delete file in PHP) I_icon_minitimeWed Nov 04, 2015 9:25 pm by thanhtruyen

» CÔNG TY TNHH VIỄN THÔNG KỲ AN - Quảng nam
Hàm xử lý file trong php(create file,create folder,write,delete file in PHP) I_icon_minitimeFri Jun 26, 2015 12:53 am by thanhtruyen

» Mua bán nhanh tại vn24s.com
Hàm xử lý file trong php(create file,create folder,write,delete file in PHP) I_icon_minitimeThu Jun 25, 2015 7:18 am by thanhtruyen

» Phát triển phần mềm t&t
Hàm xử lý file trong php(create file,create folder,write,delete file in PHP) I_icon_minitimeSat Mar 28, 2015 8:51 am by thanhtruyen

» Phát triển phần mềm
Hàm xử lý file trong php(create file,create folder,write,delete file in PHP) I_icon_minitimeTue Jan 20, 2015 7:41 pm by thanhtruyen

Statistics
Diễn Đàn hiện có 32 thành viên
Chúng ta cùng chào mừng thành viên mới đăng ký: cuongtk666

Tổng số bài viết đã gửi vào diễn đàn là 183 in 178 subjects
Social bookmarking

Social bookmarking reddit      

Bookmark and share the address of DIỄN ĐÀN CÔNG NGHỆ THÔNG TIN TIÊN PHƯỚC-QUẢNG NAM on your social bookmarking website

Bookmark and share the address of DIỄN ĐÀN CÔNG NGHỆ THÔNG TIN TIÊN PHƯỚC-QUẢNG NAM on your social bookmarking website

Thống Kê
Hiện có 1 người đang truy cập Diễn Đàn, gồm: 0 Thành viên, 0 Thành viên ẩn danh và 1 Khách viếng thăm

Không

[ View the whole list ]


Số người truy cập cùng lúc nhiều nhất là 33 người, vào ngày Wed Apr 26, 2023 2:03 pm

Hàm xử lý file trong php(create file,create folder,write,delete file in PHP)

Go down

Hàm xử lý file trong php(create file,create folder,write,delete file in PHP) Empty Hàm xử lý file trong php(create file,create folder,write,delete file in PHP)

Bài gửi  thanhtruyen Wed Jun 05, 2013 12:32 pm



Hàm xử lý file trong php(create file,create folder,write,delete file in PHP)

05/30/2013 admin PHP, 0

Hàm xử lý file trong php – Process file in php
-Xóa file

-Tạo mới 1 file

-Đọc file

-Ghi file

-Tạo mới 1 folder

-Sao chép dữ liệu file

+Xóa một file trong localhost hoặc trên hosting(Delete file)

Sử dụng hàm unlink


$filename=”test.txt”;
if (!unlink($filename))
{
echo (“Error deleting $filename”);
}
else
{
echo “Deleting”;
}

Tạo file và đọc file(Create file and read )


$filename = “log.txt”;
if(!file_exists($filename))
{
fopen($filename, “x”);
}
$file = fopen($filename, “r”);

while(!feof($file))
{
echo fgets($file);
}
fclose($file);

?>

Ghi dữ liệu vào file(Insert data to file)

$filename = “log.txt”;
$WriteType = “a”; /* kiểu ghi bằng “a” thì ghi lên file cũ ở dòng tiếp theo , kiểu ghi “w” thì ghi đè lên file cũ và xóa đi dữ liệu ban đầu*/
$str=’abcdadnlasdkjanskdnkjad’;
$file = fopen($filename, $WriteType);
fwrite($file,$str);

?>

Tạo 1 folder ,folder cha và folder con(Create folder)

/*
bool mkdir ( string $pathname [,int $mode =0777[, bool $recursive = false]])
$pathname: Tên folder
$mode: quyền truy cập vào folder(777 là cao nhất), trên window
*/

//Tạo 1 folder tên là “data”
mkdir(“data”,0777,true);
//Tạo folder cha “music” chứa folder con là “dane”
mkdir(“music/dance”,0777,true);

?>

Sao chép file(Copy file)

//File goc
$file = ‘music/goc.txt’;
//File copy moi neu chua co file news.txt he thong se tu dong tao file log.txt moi va copy du lieu tu file goc.txt qua
$newfile = ‘news.txt’;
if(!copy($file,$newfile)) echo “Loi copy” ;
?>

Chúc các bạn 1 ngày học tập vui vẻHàm xử lý file trong php

thanhtruyen

Tổng số bài gửi : 43
Join date : 28/10/2010
Age : 34
Đến từ : quảng nam

https://cntt.forumvi.com/forum.htm

Về Đầu Trang Go down

Hàm xử lý file trong php(create file,create folder,write,delete file in PHP) Empty Hàm xử lý file trong php

Bài gửi  thanhtruyen Wed Jun 05, 2013 12:33 pm


thanhtruyen

Tổng số bài gửi : 43
Join date : 28/10/2010
Age : 34
Đến từ : quảng nam

https://cntt.forumvi.com/forum.htm

Về Đầu Trang Go down

Về Đầu Trang


 
Permissions in this forum:
Bạn không có quyền trả lời bài viết