Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 20499 программистов и 943 робота. Сейчас ищут 596 программистов ...

Introduction

Вернуться к: File

Introduction

Introduction – Introduction to the File class

File provides an easy interface to PHP's builtin file and directory functions, plus some functions to deal with paths.

Using File

<?php
require_once 'File.php';

$file "/home/tal/example.txt";

//Echo the whole file
echo File::readAll($file);

//Now use a different approach
$fp = new File();

//Write a single line to the file, using a Macintosh EOL character and
//truncating the file before writing to it
$fp->writeLine($file"This is a single line"FILE_MODE_WRITE"\r");

//strip leading and trailing separators from the file path
echo $fp->stripLeadingSeparators($file);
echo 
$fp->stripTrailingSeparators($file);

?>


Вернуться к: File

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware