-----------------------------
int file_put_contents ( string $filename , mixed $data [, int $flags = 0 [, resource $context ]] )
$flags =
FILE_USE_INCLUDE_PATH
FILE_APPEND
LOCK_EX
file_put_contents('test.txt','Hello World',FILE_APPEND | LOCK_EX);
-----------------------------
array file ( string $filename [, int $flags = 0 [, resource $context ]] ) => elements = viena linija no faila
$flags =
FILE_USE_INCLUDE_PATH
FILE_IGNORE_NEW_LINES
FILE_SKIP_EMPTY_LINES
$data = file('');
print_r($data);
$data = file('file.csv'); //print_r($data);
$ll = count($data);
for ($i1 = 0; $i1 < $ll; $i1++) {
echo $data[$i1];
}
$data = file('file.csv'); //print_r($data);
foreach ($data as $line) {
echo $line;
}
foreach($masiivs as $atsleega=>$ieraksts){
}
-----------------------------
int fileatime ( string $filename ) => pedajais faila pieejas laiks
-----------------------------
int filectime ( string $filename ) => kad pedejo raizi fails tika labots, kas ir mainijes pilngi jebkas
-----------------------------
int filegroup ( string $filename ) => lietotāju tiesības
-----------------------------
int filemtime ( string $filename ) => faila modifikacijas laiks, saturs tika modificets
________________
int fileowner ( string $filename ) = īpašnieka ID
int fileperms ( string $filename ) = tiesības skaitlis 0755
----------------------------
int filesize ( string $filename ) = faila izmērs baitos
----------------------------
string filetype ( string $filename ) => fifo, char, dir, block, link, file, socket, unknown.
----------------------------
bool flock ( resource $handle , int $operation [, int &$wouldblock ] )
$handle = atvērts faila ar fileopen
LOCK_SH = bloķēt - tikai lasīšanai
LOCK_EX
LOCK_UN
----------------------------
int fpassthru ( resource $handle ) => nolasa atverto resursu un izvada no pozicijas līdz beigam
// open the file in a binary mode
$name = './img/ok.png';
$fp = fopen($name, 'rb');
// send the right headers
header("Content-Type: image/png");
header("Content-Length: " . filesize($name));
// dump the picture and stop the script
fpassthru($fp);
exit;
________________
int fputcsv ( resource $handle , array $fields [, string $delimiter = ',' [, string $enclosure = '"' ]] ) => ieraksta faila
$fields = array();
$fields[] = array("Vertiba1","Vertiba2","Vertiba3");
$fields[] = array("Vertiba4","Vertiba5","Vertiba6");
----------------------------
int fseek ( resource $handle , int $offset [, int $whence = SEEK_SET ] ) => uzstadīt kursoru uz poziciju
SEEK_SET = preciza pozicija no sakuma līdz offset baitiem
SEEK_CUR = offset tiek pieskaitams esosai pozicijai
SEEK_END = parvietot līdz faila beigam un pieskaitīt offsetu
----------------------------
array fstat ( resource $handle ) = atgriež massīvu, kas satur informāciju par failu; atime; ctime; ipasnieka ID un grupas ID;
----------------------------
int ftell ( resource $handle ) => pašreizēja pozicija kursoram failā
----------------------------
bool ftruncate ( resource $handle , int $size ) => nomet vai palielina faila izmēru līdz noradītajam izmēram
________________
array glob ( string $pattern [, int $flags = 0 ] ) => mekle ceļus kas atbilst patern, lai atrast failus lieto šo funkciju, kautkada direktorija
$faili = glob('C:\Users\student\Desktop\LIT_Porter_0120\nginx\htdocs\php\*');
print_r($faili);
----------------------------
Комментариев нет:
Отправить комментарий