PHP¸ß¼¶Óï·¨£¨Ò»£©—— Îļþ´¦Àí
PHP
Îļþ´¦Àí
fopen()
º¯ÊýÓÃÓÚÔÚ
PHP
Öдò¿ªÎļþ¡£
´ò¿ªÎļþ
fopen()
º¯ÊýÓÃÓÚÔÚ
PHP
Öдò¿ªÎļþ¡£
´Ëº¯ÊýµÄµÚÒ»¸ö²ÎÊýº¬ÓÐÒª´ò¿ªµÄÎļþµÄÃû³Æ£¬µÚ¶þ¸ö²ÎÊý¹æ¶¨ÁËʹÓÃÄÄÖÖģʽÀ´´ò¿ªÎļþ£º
<html>
<body>
<?php
$file=fopen("welcome.txt","r");
?>
</body>
</html>
Îļþ¿ÉÄÜͨ¹ýÏÂÁÐģʽÀ´´ò¿ª£º
ģʽ
ÃèÊö
r
Ö»¶Á¡£ÔÚÎļþµÄ¿ªÍ·¿ªÊ¼¡£
r+
¶Á
/
д¡£ÔÚÎļþµÄ¿ªÍ·¿ªÊ¼¡£
w
ֻд¡£´ò¿ª²¢Çå¿ÕÎļþµÄÄÚÈÝ£»Èç¹ûÎļþ²»´æÔÚ£¬Ôò´´½¨ÐÂÎļþ¡£
w+
¶Á
/
д¡£´ò¿ª²¢Çå¿ÕÎļþµÄÄÚÈÝ£»Èç¹ûÎļþ²»´æÔÚ£¬Ôò´´½¨ÐÂÎļþ¡£
a
×·¼Ó¡£´ò¿ª²¢ÏòÎļþÎļþµÄÄ©¶Ë½øÐÐд²Ù×÷£¬Èç¹ûÎļþ²»´æÔÚ£¬Ôò´´½¨ÐÂÎļþ¡£
a+
¶Á
/
×·¼Ó¡£Í¨¹ýÏòÎļþÄ©¶ËдÄÚÈÝ£¬À´±£³ÖÎļþÄÚÈÝ¡£
x
ֻд¡£´´½¨ÐÂÎļþ¡£Èç¹ûÎļþÒÔ´æÔÚ£¬Ôò·µ»Ø
FALSE
¡£
x+
¶Á
/
д¡£´´½¨ÐÂÎļþ¡£Èç¹ûÎļþÒÑ´æÔÚ£¬Ôò·µ»Ø
FALSE
ºÍÒ»¸ö´íÎó¡£
×¢ÊÍ£ºÈç¹û
fopen()
ÎÞ·¨´ò¿ªÖ¸¶¨Îļþ£¬Ôò·µ»Ø
0 (false)
¡£
Àý×Ó
Èç¹û
fopen()
²»ÄÜ´ò¿ªÖ¸¶¨µÄÎļþ£¬ÏÂÃæµÄÀý×Ó»áÉú³ÉÒ»¶ÎÏûÏ¢£º
<html>
<body>
<?php
$file=fopen("welcome.txt","r")
or exit("Unable to open file!");
?>
</body>
</html>
¹Ø±ÕÎļþ
fclose()
º¯ÊýÓÃÓڹرմò¿ªµÄÎļþ¡£
<?php
$file
= fopen("test.txt","r");
//some
code to be executed
fclose($file);
?>
¼ì²â
End-of-file
feof()
º¯Êý¼ì²âÊÇ·ñÒÑ´ïµ½ÎļþµÄÄ©¶Ë
(EOF)
¡£
ÔÚÑ»·±éÀúδ֪³¤¶ÈµÄÊý¾Ýʱ£¬
feof()
º¯ÊýºÜÓÐÓá£
×¢ÊÍ£º
ÔÚ
w
¡¢
a
ÒÔ¼°
x
ģʽ£¬ÄúÎÞ·¨¶ÁÈ¡´ò¿ªµÄÎļþ£¡
if
(feof($file)) echo "End of file";
ÖðÐжÁÈ¡Îļþ
fgets()
º¯ÊýÓÃÓÚ´ÓÎļþÖÐÖðÐжÁÈ¡Îļþ¡£
×¢ÊÍ£º
ÔÚµ÷Óøú¯ÊýÖ®ºó£¬ÎļþÖ¸Õë»áÒÆ¶¯µ½ÏÂÒ»ÐС£
Àý×Ó
ÏÂÃæµÄÀý×ÓÖðÐжÁÈ¡Îļþ£¬Ö±µ½ÎļþÄ©¶ËΪֹ£º
<?php
$file
= fopen("welcome.txt", "r") or exit("Unable to open
file!");
//Output
a line of the file until the end is reached
while(!feof($file))
{
echo fgets($file). "<br />";
Ïà¹ØÎĵµ£º
http://blog.s135.com/read.php/142.htm
¡¡¡¡×î½üÔÚдPHP³ÌÐòʱ£¬ÐèҪʹä¯ÀÀÆ÷ÔÚhttpsºÍhttpÖ®¼äת»¯£¬ÉÏÍøËÑË÷Ïà¹ØÐÅÏ¢£¬ÎÞÄÎÖ»ÓÐ×î½üÔÚдPHP³ÌÐòʱ£¬ÐèҪʹä¯ÀÀÆ÷ÔÚhttpsºÍhttpÖ®¼äת»¯£¬ÉÏÍøËÑË÷Ïà¹ØÐÅÏ¢£¬ÎÞÄÎÖ»ÓÐһƪ½éÉÜÓÃASPʵÏÖ“ÔÚhttpºÍhttpsÖ®¼äת»¯”µÄÎÄÕ£¬ÓÚÊÇÖ»ºÃÐÐдÁËÓÃPHPʵÏÖhttpÓëhttpsת» ......
<html>
<head>
<title>Uploading...</title>
</head>
<body>
<h1>Uploading file...</h1>
<?php
echo '<pre>';
print_r($_FILES);
echo '</pre>';
if ($_F ......
1)
°²×°Apache/2.2.14 ºÍ PHP/5.2.12 Ö®ºó£¬ÖØÐÂÆô¶¯Apache£¬Æô¶¯Ê§°Ü¡£²éÁËһЩ×ÊÁÏ£¬»ù±¾Éϸø³öµÄ½¨ÒéÊǽûµôExtension¡£ÎÒ¾Í×°ÁËÒ»¸öExtesion Mysqli¡£
ÐÞ¸Äphp.ini ×¢Ê͵ôÕâÒ»ÐУ¬¹ûÈ»ÉúЧ¡£
[PHP_MYSQLI]
;extension=php_mysqli.dll
°²×°Íêmysql£¬ÔÙÖØÐÂenableÕâ¸öÅäÖþͺÃÁË£¬¹À¼ÆÊÇÒÀÀµÄ³Ð©mysqlµÄ¿â¡£
......
1¡¢
Ê×ÏÈÈ¥http://pear.php.net/package/Pager ÏÂÔØ Pager°ü£ºPager-2.4.8.tgz
£»
2¡¢
½âѹµ½×Ô¼ºµÄ¹¤×÷Ŀ¼
3¡¢
ʾÀýÈçÏ£º
<?php
require_once('Pager/Pager.php');
$params = array(
'itemData' => $re, //Òª½øÐзÖÒ³µÄ½á¹ûÊý×é
'perPage' => 12, //ÿҳµÄ¼Ç¼Êý
'd ......
±íµ¥ºÍÓû§ÊäÈë
PHP ±íµ¥´¦Àí
±íµ¥ÊµÀý£º
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html> ......