PHPÁ¬½ÓMysqL
Á¬½Ó£º
$conn=mysql_connect ("localhost:3306", "username", "password");
mysql_select_db("DBname");
¶Á£º
$exec="select * from stu";
$result=mysql_query($exec);
while($rs=mysql_fetch_object($result))
{
echo $rs->id." ".$rs->name." ".$rs->age." ".$rs->sex;
echo "<br>";
}
Ïà¹ØÎĵµ£º
£¨1£©¡¢yum°²×°mysql
//yum°²×°
yum -y install mysql mysql_server
//ÔÚ·þÎñÇåµ¥ÖÐÌí¼Ómysql·þÎñ
chkconfig --add mysqld
//·þÎñÆô¶¯
service mysqld start
//³õʼ»¯mysqlÊý¾Ý¿â
/usr/bin/mysql_secure_installation
£¨2£©¡¢°²×°apache
yum -y install httpd
service httpd start
Ìí¼ÓiptablesÔÊÐí·Ã ......
˵Ã÷£ºÒòΪ×î½ü¹¤×÷¹¤×÷¹Øϵ£¬ÐèÒª¿ª·¢Ò»¸öÔÚLinuxÏÂÔËÐеÄWeb Application£¬ÐèÒª¶ÔÏÖÔڱȽÏÁ÷ÐеÄһЩPHP¿ò¼Ü×öÒ»¸öÁ˽âºÍÆÀ¹À£¬ÏÂÃæµÄÕâƪÎÄÕÂÊDZÊÕß×î½üѧϰһ¸ö±È½ÏеÄPHP FrameworkµÄÒ»µã¾ÀúºÍ²Ù×÷²½Ö裬ÒòΪ¹Ù·½µÄÊÖ²áдµÃ±È½Ï»Þɬ£¨ÌرðÊÇÖÐÎĵģ©£¬Ôø¾³¢ÊÔ±é¶ÁËüÄǸöÊÖ²áÔÙ¶¯ÊÖ£¬¶ÁÁËÒ»´ó°ë·¢ÏÖÈÔÎÞ·¨Àí½â£¬ÓÚÊÇ ......
global¶¨ÒåÒ»¸öÈ«¾Ö±äÁ¿£¬Õâ¸öÈ«¾Ö±äÁ¿²»ÊÇÓ¦ÓÃÕû¸öÍøÕ¾£¬¶øÊÇÓ¦ÓÃÓ뵱ǰҳÃ棨°üÀ¨requireºÍincludeÎļþ£©Îļþ¡£
$aa="test";
function test()
{
global $aa;
echo $aa;
}
test(); //print test
º¯ÊýÄÚ¶¨ÒåµÄ±äÁ¿º¯ÊýÍâ¿ÉÒÔµ÷Óã¬ÔÚº¯ÊýÍⶨÒåµÄµÄ±äÁ¿º¯ÊýÄÚ²»ÄÜʹÓá£
gl ......
ÔÚ PHP ±à³ÌÔçÆÚ£¬PHP ´úÂëÔÚ±¾ÖÊÉÏÊÇÏÞÓÚÃæÏò¹ý³ÌµÄ¡£¹ý³Ì´úÂë µÄÌØÕ÷ÔÚÓÚʹÓùý³Ì¹¹½¨Ó¦ÓóÌÐò¿é¡£¹ý³Ìͨ¹ýÔÊÐí¹ý³ÌÖ®¼äµÄµ÷ÓÃÌṩijÖ̶ֳȵÄÖØÓá£
µ«ÊÇ£¬Ã»ÓÐÃæÏò¶ÔÏóµÄÓïÑÔ¹¹Ô죬³ÌÐòÔ±ÈÔÈ»¿ÉÒÔ°Ñ OO ÌØÐÔÒýÈëµ½ PHP ´úÂëÖС£ÕâÑù×öÓеãÀ§ÄѲ¢ÇÒ»áʹ´úÂëÄÑÓÚÔĶÁ£¬ÒòΪËüÊÇ»ìºÏ·¶Àý£¨º¬ÓÐα OO Éè¼ÆµÄ¹ý³ÌÓïÑÔ£ ......