PHPѧϰ
Ç°¼¸ÌìÔÚѧϰPHPµÄʱºò×öÁËÒ»¸ö¼òµ¥µÄÊý¾ÝÔöɾ¸ÄµÄ³ÌÐò£¬ÓÉÓÚ×Ô¼ºÊǵÚÒ»´Î½Ó´¥PHPËùÒÔÔÚÐí¶àµØ·½×öµÄ²»µ½Î»£¬¸Ð¾õºÜǣǿ£¬µ«ÊDZϾ¹ÊÇ»¨ÁËʱ¼äµÄ£¬ËùÒÔÏÖÔÚÌù³öÀ´¡£
1.Íê³ÉÔöɾ²é¸ÄµÄÖ÷Ò³Ã棺connsql.php
<h1>Data Insert Delete Update</h1>
<?php
//»ñµÃÊý¾Ý¿âÁ¬½Ó
require("connectionDB.php");
// ´Ó±íÖÐÌáÈ¡ÐÅÏ¢µÄsqlÓï¾ä
$strsql="select * from personal_info";
// Ö´ÐÐsql²éѯ
$result=mysql_db_query($mysql_database, $strsql, $conn);
// »ñÈ¡²éѯ½á¹û
$row=mysql_fetch_row($result);
echo '<font face="verdana">';
echo '<table border="1" cellpadding="1" cellspacing="2">';
// ÏÔʾ×Ö¶ÎÃû³Æ
echo "\n<tr>\n";
for ($i=0; $i<mysql_num_fields($result); $i++)
{
echo '<td bgcolor="#EEFFFF"><b>'.
mysql_field_name($result, $i);
echo "</b></td>\n";
}
//ɾ³ý
echo '<td bgcolor="#EEFFFF">';
echo "delete";
echo '</td>';
//ÐÞ¸Ä
echo '<td bgcolor="#EEFFFF">';
echo "update";
echo '</td>';
echo "</tr>\n";
// ¶¨Î»µ½µÚÒ»Ìõ¼Ç¼
mysql_data_seek($result, 0);
// Ñ»·È¡³ö¼Ç¼
while ($row=mysql_fetch_row($result))
{
echo "<tr>\n";
for ($i=0; $i<mysql_num_fields($result); $i++ )
{
Ïà¹ØÎĵµ£º
×î½üÔÚ×öÒ»¸öÏîÄ¿£¬Óöµ½AJAXÖÐÎÄÂÒÂëÎÊÌ⣬¾¹ýÒ»¸öÏÂÎçµÄŬÁ¦ÖÕÓÚÍêÃÀ½â¾ö£¬ÏÖ½«ÐĵÃдÏÂÀ´£¬Ï£Íû¶ÔÄÇЩ»¹À§ÈÆÔÚÕâ¸öÎÊÌâ¶øÍ·Í´²»ÒѵÄÈËÃÇÓÐËù°ïÖú¡£
ÖÚËùÖÜÖª£¬Ê¹ÓÃAJAX´«ËͺͽÓÊÕÖÐÎIJÎÊýʱ£¬Èç¹û²»ÔÚ¿Í»§¶ËºÍ·þÎñÆ÷×öÏàÓ¦µÄ´¦Àí¾Í»á³öÏÖÂÒÂëÎÊÌ⣬ÔÚÍøÉÏÏàÓ¦µÄÎÄÕÂÒ²²»ÉÙ£¬µ«ÊÇÓеÄÇé¿öϺÜÄÑ´ÓÖÐÕÒµ½·ûºÏ×Ô¼ºÀíÏëµÄ´ð ......
1¡¢Ê¹Óþø¶Ô·¾¶°üº¬Îļþ
ÔÚÿ´Î¶ÔÎļþµÄ°üº¬ÖУ¬¶¼Ê¹ÓÃϵͳ¾ø¶Ô·¾¶½øÐаüº¬£¬±ÈÈç require('/var/www/html/inc/test.inc')£»µÄ·½Ê½£¬ÔÚËùÓÐÎļþÖж¼ÕâÑù°üº¬¾Í¿ÉÒÔ±ÜÃâ¶à¼¶°üº¬³öÏÖµÄÎÊÌ⣬µ«ÊÇÕâÖз½Ê½²»Áé»î£¬ÏµÍ³¿ÉÒÆÖ²ÐÔ¼«²î£¬½¨Òé²»²ÉÓá£
2¡¢ÔÚÒ»¸ö¹«ÓÃÎļþÖж¨Ò幫ÓÃÎļþµÄÁÐ±í£¬½«¸÷¸ö¹«ÓÃÎļþµÄ ......
fopen() º¯ÊýÓÃÓÚÔÚ PHP Öдò¿ªÎļþ¡£
´Ëº¯ÊýµÄµÚÒ»¸ö²ÎÊýº¬ÓÐÒª´ò¿ªµÄÎļþµÄÃû³Æ£¬µÚ¶þ¸ö²ÎÊý¹æ¶¨ÁËʹÓÃÄÄÖÖģʽÀ´´ò¿ªÎļþ£º
<?php
$file=fopen("welcome.txt","r");
?>
Îļþ¿ÉÄÜͨ¹ýÏÂÁÐģʽÀ´´ò¿ª£º
r : Ö»¶Á¡£Ö¸Õ붨λÔÚÎļþµÄ¿ªÍ·£¬Èç¹ûÎļþ²»»á±¨´í¡£
r+ : ¶Á/д¡£Ö¸Õ붨λÔÚÎļþµÄ¿ªÍ·,Èç ......
Ò»¸ö¼òµ¥µÄÀý×Ó¶ÁÈ¡CSVÎļþ£º
<?php
$handle=fopen("test.csv","r");
echo "<table border=2>";
//ÅäºÏwhileÑ»·¶ÁÈ¡Îļþ
while($data=fgetcsv($handle,1024))
{
list($user,$pwd,$partment,$title)=$data;
echo "<tr>
<td>$user</td>
<td>$pwd< ......
ÕªÒª£ºÒ»¡¢Éæ¼°µ½µÄΣÏÕº¯Êý¡²include(),require()ºÍinclude_once(),require_once()¡³ include()&&require()Óï¾ä:°üÀ¨²¢ÔËÐÐÖ¸¶¨Îļþ¡£ÕâÁ½Öֽṹ³ýÁËÔÚÈçºÎ´¦Àíʧ°ÜÖ®ÍâÍêÈ«Ò»Ñù¡£include()²úÉúÒ»¸ö¾¯¸æ¶ørequire()Ôòµ¼ÖÂÒ»¸öÖÂÃü´íÎó¡£»»¾ä»°Ëµ£¬Èç¹ûÄãÏëÔÚÓöµ½¶ªÊ§Îļþʱֹͣ´¦ÀíÒ³Ãæ¾ÍÓÃrequire()¡£include() ......