Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PHP MVC ѧϰ ThinkPHP

1.ʲôÊÇMVC£¿
MVC±¾À´ÊÇ´æÔÚÓÚDesktop£¨×ÀÃ棩³ÌÐòÖеģ¬MÊÇÖ¸Êý¾ÝÄ£ÐÍ£¬VÊÇÖ¸Óû§½çÃ棬CÔòÊÇ¿ØÖÆÆ÷¡£Ê¹ÓÃMVCµÄÄ¿µÄÊǽ«MºÍVµÄʵÏÖ´úÂë·ÖÀë¡£MVCÊÇÒ»¸öÉè¼Æģʽ£¬ËüÇ¿ÖÆÐÔµÄʹӦÓóÌÐòµÄÊäÈ룬´¦ÀíºÍÊä³ö·Ö¿ª¡£Ê¹ÓÃMVCÓ¦ÓóÌÐò±»·ÖΪÈý¸öºËÐIJ¿¼þ£ºÄ£ÐÍ£¬ÊÔͼ£¬¿ØÖÆÆ÷¡£ËüÃǽ«´¦Àí×Ô¼ºµÄÈÎÎñ¡£
2.ΪʲôҪʹÓÃMVC?
Ê×ÏÈ£¬×îÖØÒªµÄÒ»µãÊǶà¸öÊÓͼÄܹ²ÏíÒ»¸öÄ£ÐÍ£¬ÏÖÔÚÐèÒªÓÃÔ½À´Ô½¶àµÄ·½Ê½À´·ÃÎÊÄãµÄÓ¦ÓóÌÐò¡£ÓÉÓÚÄ£ÐÍ·µ»ØµÄÊý¾ÝûÓнøÐиñʽ»¯£¬ËùÒÔͬÑùµÄ¹¹¼þÄܱ»²»Í¬½çÃæʹÓá£ÔٴΣ¬¿ª·¢ÖÜÆÚËõ¶Ì£¬·½±ãά»¤ºÍ¹ÜÀí½µµÍ¿ª·¢³É±¾ºÍ¹¤×÷Á¿¡£
MVCµÄȱµãÊÇÓÉÓÚËüûÓÐÃ÷È·µÄ¶¨Ò壬ËùÒÔÍêÈ«Àí½âMVC²¢²»ÊǺÜÈÝÒס£Ê¹ÓÃMVCÐèÒª¾«Ðĵļƻ®£¬ÓÉÓÚËüµÄÄÚ²¿Ô­Àí±È½Ï¸´ÔÓ£¬ËùÒÔÐèÒª»¨·ÑһЩʱ¼äȥ˼¿¼¡£
MVC²¢²»ÊʺÏСÐÍÉõÖÁÖеȹæÄ£µÄÓ¦ÓóÌÐò£¬»¨·Ñ´óÁ¿Ê±¼ä½²MVCÓ¦Óõ½¹æÄ£²¢²»ÊǺܴóµÄÓ¦ÓóÌÐòͨ³£»áµÃ²»³¥Ê§¡£
3.ÈÏʶһ¸öMVC¿ò¼ÜThinkPHP
ThinkPHPÊÇÒ»¸ö¿ìËÙ£¬¼òµ¥µÄÃæÏò¶ÔÏóµÄÇáÁ¿¼¶PHP¿ª·¢¿ò¼Ü£¬×ñÑ­Apache2¿ªÔ´Ð­Òé·¢²¼£¬²¢ÇÒÓÀ¾ÃÃâ·ÑʹÓã¬ÊÇΪ¼ò»¯ÆóÒµ¼¶Ó¦Óÿª·¢ºÍÃô½ÝWEBÓ¦Óÿª·¢¶øµ®ÉúµÄ¡£Ê¹ÓÃThinkPHP£¬Äã¿ÉÒÔ¸ü·½±ãºÍ¿ì½ÝµÄ¿ª·¢ºÍ²¿ÊðWEBÓ¦Óá£
Ìص㣺
¼òµ¥Ò×ÓõÄMVCģʽ  ¶À´´µÄºËÐıàÒëºÍÏîÄ¿±àÒë»úÖÆ ÄÚÖÃXMLÄ£°åÒýÇ棬֧³Ö±êÇ©¿â¸»Ä£ÐÍÖ§³Ö
Ŀ¼½á¹¹×Ô¶¯´´½¨   ·Ö²¼Ê½Êý¾Ý¿âÖ§³Ö   ¶àÊý¾Ý¿âÁ¬½ÓºÍÇл»Ö§³Ö   CURDºÍ²Ù×÷¸ß¶È×Ô¶¯»¯Ö§³Ö
4.ÈçºÎ´î½¨Ò»¸öThinkPHP
ÏÂÔØThinkPHP¿ò¼Ü°ü£¬Ö±½ÓÒýÓÃĿ¼ÖеÄThinkPHP.phpÎļþ¼´¿É
index.php
<?php
define('THINK_PATH','ThinkPHP/');
define('APP_NAME','phpName');
define('APP_PATH','.');
require(THINK_PATH."/ThinkPHP.php");
$App=new App();//ʵÀý»¯²Ù×÷ϵͳ»á×Ô¶¯´´½¨¿ª·¢Ä¿Â¼
$App->run();
?>
5.ThinkPHPµÄ¼òµ¥Ê¹ÓÃ
£¨1£©ThinkPHPÈçºÎ´´½¨Ò»¸ö¿ØÖÆÆ÷
Ö»ÐèÔÚLib\ActionĿ¼Ï´´½¨Ò»¸ö¶ÔÓ¦µÄ¿ØÖÆÆ÷µÄÀà¸ñʽname.class.php
(2)ThinkPHP URL·ÓÉÄ£µÄ½âÎö
²ÉÓõ¥Ò»Èë¿Ú·½Ê½£¬ÌṩÁËÒ»¸öURL·ÓÉģʽ½âÎö/
Ö´ÐÐÉÏÃæµÄindex.php»á×Ô¶¯´´½¨ºÃĿ¼¡£
6.ThinkPHPÅäÖÃÎļþ
\ThinkPHP\Common\conwention.php
'DEFAULT_MODULE'=>'index',//ĬÈÏÄ£¿éÃû³Æ
'DEFAULT_ACTION'=>'index',//ĬÈϲÙ×÷Ãû³Æ
'DEBUG_MODE'=>false,//µ÷ÊÔģʽĬÈϹرÕ
//¹ßÀýÅäÖö¨Òå±äÁ¿Ãû´óСдÈÎÒ⣬¶¼»áËûżÄǸöһת»»³ÉСд
//


Ïà¹ØÎĵµ£º

Ìá¸ßPHP±à³ÌЧÂʵÄ53¸öÒªµã

Óõ¥ÒýºÅ´úÌæË«ÒýºÅÀ´°üº¬×Ö·û´®£¬ÕâÑù×ö»á¸ü¿ìһЩ¡£ÒòΪPHP»áÔÚË«ÒýºÅ°üΧµÄ×Ö·û´®ÖÐËÑÑ°±äÁ¿£¬µ¥ÒýºÅÔò²»»á£¬×¢Ò⣺ֻÓÐechoÄÜÕâô×ö£¬ËüÊÇÒ»ÖÖ¿ÉÒ԰Ѷà¸ö×Ö·û´®µ±×÷²ÎÊýµÄ“º¯Êý”£¨Òë×¢£ºPHPÊÖ²áÖÐ˵echoÊÇÓïÑԽṹ£¬²»ÊÇÕæÕýµÄº¯Êý£¬¹Ê°Ñº¯Êý¼ÓÉÏÁËË«ÒýºÅ£©¡£
1¡¢Èç¹ûÄܽ«ÀàµÄ·½·¨¶¨Òå³Éstatic£¬¾Í¾¡Á¿¶¨Ò ......

phpÖÐfopen²»ÄÜ´´½¨ÖÐÎÄÎļþÃûÎļþµÄÎÊÌâ

֮ǰÍøÒ³µÄchartsetÓõÄÊÇutf-8£¬ÎļþÒ²ÓÃutf-8£¬È»ºóÓÃfopen()´´½¨Ò»¸öÖÐÎÄÎļþÃûµÄÎļþʱÎÊÌâ¾Í³öÀ´ÁË£¬ÎļþÃû¶¼ÊÇÂÒ
Â룡
²é¿´Á˺ܶàÎĵµÊÔÁ˲»ÉÙ·½·¨¶¼½â¾ö²»ÁË£¬±¾À´Ïë×ÅÓñðµÄ·½·¨ÈƹýÕâ¸öÎÊÌ⣬ºöÈ»ÄÔ×ÓÀïÉÁ¹ýWindowsĬÈϵÄÎÄ×Ö±àÂëÊÇansi£¬È»ºóÔÙ
baiduÁËһϣ¬Ö¤ÊµÁËÕâµã£¬ËùÒÔÎÒµÄÍøÒ³Ò²Ó¦¸ÃÊÇansi±àÂë²ÅÄÜʹ´ ......

ÀûÓÃphp»ñÈ¡Êý¾Ý¿âÖÐËùÓÐÐÅÏ¢¿É²Î¿¼phpMyAdmin


<?php
@mysql_connect("localhost", "root","1981427") //Ñ¡ÔñÊý¾Ý¿â֮ǰÐèÒªÏÈÁ¬½ÓÊý¾Ý¿â·þÎñÆ÷
or die("Êý¾Ý¿â·þÎñÆ÷Á¬½Óʧ°Ü");
$dbs = mysql_list_dbs(); //µ÷ÓÃmysql_list_dbsº¯Êý
while ($array = mysql_fetch_row($dbs)) //Ñ­»·Êä³öËùÓеÄÊý¾Ý¿âÃû³Æ
{
echo "$array[0]<BR>";
}
?>
& ......

php ÕýÔò±í´ïʽ »ù±¾ÖªÊ¶

“^The” :  ÒÔ”The”¿ªÍ·
“of despair$” :   ÒÔ”of despair”½áβ
“^abc$” :    ×Ö·û´®”abc”
“notice”  :   °üº¬”notice”µÄ×Ö·û´®
¾ÍÏñ×îºóÒ»¸öÀý×ÓÒ»Ñù£¬Èç¹ûûÓж¨Òå±ß ......

php define() º¯Êý¼°defined£¨£©º¯ÊýµÄÓ÷¨


The define() function defines a constant.
define()º¯ÊýµÄ×÷ÓÃÊÇ£º¶¨ÒåÒ»¸ö³£Á¿¡£
Constants are much like variables, except for the following differences:
³£Á¿[constant]Óë±äÁ¿[variable]ÓкܶàÏàËƵĵط½£¬Òò´Ë£¬ºÜÈÝÒ×»ìÏý£»ÏÂÃ棬ÎÒÃÇÁоÙһϳ£Á¿[constant]Óë±äÁ¿[variable]Ö®¼äµÄ²»Í¬µã£º
A constant's ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ