PHP ???? ?? ?? ??
?? ??
fopen() ??? PHP?? ??? ?? ? ?????.
??? ? ?? ?????? ??? ??? ?????. ? ?? ????? ??? ?? ? ??? ??? ?????.
<html>
<body>
welcome.txt","r") ;
?>
</body>
</html>
??? ?? ??? ?? ??? ? ????. ??
r ?? ?????. ??? ?? ???? ?????.r+ ??/??. ??? ?? ???? ?????.
w ?? ?????. ?? ??? ?? ????. ??? ??? ? ??? ????. w+ ??/??. ?? ??? ?? ????. ??? ??? ? ??? ????. ~ ~??????????????????????????? ?????. ??? ?? ?? ?? ???, ??? ??? ? ??? ????. a+ ??/??. ?? ?? ???? ?? ??? ?????. x ?? ?????. ? ??? ????. ??? ?? ???? ?? FALSE? ??? ?????. x+ ??/??. ? ??? ????. ??? ?? ???? ?? FALSE? ??? ?????. ??: fopen() ??? ??? ??? ? ? ??? 0(false)? ?????. ?? ??fclose() ??? ?? ??? ?? ? ?????.
<?php$file = fopen("test.txt","r");
//?? ?? fclose($file);
?>
?? ?(EOF) ??
feof() ??? ?? ?(EOF)? ????? ??? ?????.
feof() ??? ??? ? ? ?? ???? ??? ? ?????.
??: w, a ? x ????? ?? ?? ??? ?? ? ????!
if (feof($file)) echo "?? ?";
??? ??? ??
???? ??? ????? fgets() ??? ?????.
??: ? ??? ???? ?? ???? ?? ?? ?????.
<?php
$file = fopen("welcome.txt", "r") orexit("??? ? ? ????!");
// ??? ? ?? ????. , ?? ???
while(!feof($file)){
echo fgets($file). "<br>";
}
fclose($file);
? >
??? ?? ??? ??
fgetc() ??? ??? ?? ??? ?? ? ?????. ????.
??: ? ??? ???? ?? ???? ?? ??? ?????.
<?php
$file=fopen("welcome.txt","r") ?? ??("??? ? ? ????!");
while (!feof($file)){
echo fgetc($file);
}
fclose($file);
?>