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

PHPÖлùÓÚMVCģʽµÄСÐÍÏîÄ¿×ܽá

×î½ü×öÁ˼¸¸öСÐ͵ÄÏîÄ¿£¬±È½Ï¼òµ¥£¬Ö»ÊÇÐèҪϸÐÄ£¬¶¼¿ÉÒÔÍê³É£¬Ö÷ÒªÊǶÔMVCģʽµÄÊìÁ·Ó¦Ó㬶ÔWEBÀ࿪·¢»¹ÊǺÜÓаïÖúµÄ¡£
¸Õ¿ªÊ¼µÄµÚÒ»¸öСÏîÄ¿£¬ÓÃÀ´Á·ÊÖ£¬È»ºóÎÒÈ«²¿ÊÇÁ÷³Ì»¯µÄ±à³Ì¡£´úÂëÒ²¾Í400ÐÐ×óÓÒ¡£½á¹ûÎҵĵ¼Ê¦£¬¾õµÃ´úÂë½á¹¹²»ÇåÎú£¬²»ÈÝÒ×
ά»¤£¬ÐèÒªÐ޸ġ£ÐèÒªÎÒ²ÉÓÃOOÀàµÄ±à³Ì·½Ê½½øÐиÄд¡£ÎÒÒÔǰдPHP£¬¼¸ºõÈ«²¿Êǽṹ»¯µÄ´úÂë¡£¿ªÊ¼Ð´OO·½ÃæµÄ´úÂ룬»¹ÕæµÄ²»
ÊìϤÁË¡£ÒÔÇ°×öJAVAµÄʱºò£¬Ð´ClassÊǺܵÃÐÄÓ¦Êֵġ£ÖØпªÊ¼Ñ§Ï°OO£¬¼¸¸öСʱ£¬ÂýÂý¾ÍÃþÊìϤÁË¡£
È»ºóµÚ¶þ¸ö°æ±¾³öÀ´ÁË£¬È«²¿ÔÚÒ»¸öÀàÖУ¬µ÷ÓÃÁËN¸ö»¥²»Ïà¸ÉµÄ·½·¨¡£ÊµÀý»¯Õâ¸öÀ࣬Ȼºóµ÷Ó㬸㶨¡£
µ¼Ê¦ÒÀÈ»¾õµÃ½á¹¹²»Ã÷Îú£¬Ö»ÊDZȵÚÒ»¸ö°æ±¾ÓÐЩ¸Ä½ø¡£ÓÚÊǸúÎÒÏêϸµÄ½²½âÁËMVCµÄģʽ£¬ÎÒÔÚ½ÓÏÂÀ´µÄ¼¸¸ö°æ±¾£¬¶¼²ÉÓÃÁËMVCģʽ£º
£¨1£©Model²ã£º¹¹ÔìÒ»¸öClassÀ࣬ȻºóÔÚPHP5ÖеÄpublic function __construct(){}£¬¶ÔһЩ˽ÓбäÁ¿½øÐгõʼ»¯£¬È»ºóÔÚÐèÒªµÄ
                       µØ·½µ÷ÓÃ$this->_var£»ËüÖ»¸ºÔðºÍÊý¾ÝÔ´´ò½»µÀ£¬±ÈÈçDB£¬Îļþ£¬»òÕßÆäËû¡£
£¨2£©Control²ã£º¹¹ÔìÒ»¸öClassÀ࣬ȻºóÒýÈëModelµÄÎļþ£¬¶Ô²¿·ÖÊý¾Ý½øÐÐÒµÎñÂß¼­µÄ´¦Àí£¬ÆäÖÐÒ»°ãÓиö·½·¨£ºrender()£¬È»ºó¾Í
                        ¿ÉÒÔ°ÑÐèÒªµÄÊý¾ÝäÖȾµ½smartyÖÐÈ¥¡£ÓÉÓںܶàsmartyµÄÉú³É·½·¨¶¼Ïàͬ£¬ÓÚÊÇÎÒÔÚControlÖÐҲдÁËÒ»¸ögetSmarty£¨£©
                        ·½·¨£¬Æäʵ¿ÉÒÔдÈëµ½Ò»¸öcommonµÄPHPÎļþÖС£/**
* @param string $dir //´ÓʲôĿ¼Éú³ÉÄ£°åÎļþ
*/
function getSmarty($dir)
{
require('Smarty.class.php');
$s = new Smarty;
$s->debugging = false;
$s->template_dir = $dir.'/template/';
$s->compile_dir = $dir.'/template_c/';
$s->left_delimiter = '<{';
$s->right_delimiter = '}>';
$s->compile_check = true;
$s->debugging = false;
return $s;
}
£¨3£©index.phpÎļþ£¬ÒýÈëControl²ãµÄÀàÎļþ£¬È»ºóÊ


Ïà¹ØÎĵµ£º

±àд°²È« PHP Ó¦ÓóÌÐòµÄÆ߸öÏ°¹ß

ÔÚÌá¼°°²È«ÐÔÎÊÌâʱ£¬ÐèҪעÒ⣬³ýÁËʵ¼ÊµÄƽ̨ºÍ²Ù×÷ϵͳ°²È«ÐÔÎÊÌâÖ®Í⣬Äú»¹ÐèҪȷ±£±àд°²È«µÄÓ¦ÓóÌÐò¡£ÔÚ±àд PHP Ó¦ÓóÌÐòʱ£¬ÇëÓ¦ÓÃÏÂÃæµÄÆ߸öÏ°¹ßÒÔÈ·±£Ó¦ÓóÌÐò¾ßÓÐ×îºÃµÄ°²È«ÐÔ£º
ÑéÖ¤ÊäÈë
±£»¤Îļþϵͳ
±£»¤Êý¾Ý¿â
±£»¤»á»°Êý¾Ý
±£»¤¿çÕ¾µã½Å±¾£¨Cross-site scripting£¬XSS£©Â©¶´
¼ìÑé±íµ¥ post
Õ ......

Îå¸ö³£¼û PHP Êý¾Ý¿âÎÊÌâ

Èç¹ûÖ»ÓÐÒ»ÖÖ ·½Ê½Ê¹ÓÃÊý¾Ý¿âÊÇÕýÈ·µÄ……
Äú¿ÉÒÔÓúܶàµÄ·½Ê½´´½¨Êý¾Ý¿âÉè¼Æ¡¢Êý¾Ý¿â·ÃÎʺͻùÓÚÊý¾Ý¿âµÄ PHP ÒµÎñÂß¼­´úÂ룬µ«×îÖÕÒ»°ãÒÔ´íÎó¸æÖÕ¡£±¾ÎÄ˵Ã÷ÁËÊý¾Ý¿âÉè¼ÆºÍ·ÃÎÊÊý¾Ý¿âµÄ PHP ´úÂëÖгöÏÖµÄÎå¸ö³£¼ûÎÊÌ⣬ÒÔ¼°ÔÚÓöµ½ÕâЩÎÊÌâʱÈçºÎÐÞ¸´ËüÃÇ¡£
ÎÊÌâ 1£ºÖ±½ÓʹÓà MySQL
Ò»¸ö³£¼ûÎÊÌâÊǽÏÀ쵀 PH ......

PHP:¶ÌÐżà¿ØÍøÕ¾ÔËÐÐ״̬


Ô¤ÆÚ×¼±¸£º
Ò»¸ö139ÓÊÏ䣬ÊÕµ½Óʼþºó£¬¿ÉÒÔÃâ·Ñ¸øÄã¶ÌÐÅÌáÐÑ¡£Èç¹ûÄã²»ÐèÒª¶ÌÐÅÌáÐѹ¦ÄÜ£¬ÓÃʲôÓÊÏ䶼¿ÉÒÔ
ÁíÍâÒ»¸ö¿ÉÒÔÔËÐÐPHPÎļþµÄWeb·þÎñÆ÷£¨Ï൱ÓÚ¼à¿Ø·þÎñÆ÷£©£¬ÏÖÔÚÃâ·ÑµÄPHPÍøÕ¾¿Õ¼äºÜ¶à£¬ÉÏÍøËÑËÑ¡£Èç¹û½«PHP¼à¿ØÎļþ·Åµ½Äã×Ô¼ºµÄ·þÎñ
Æ÷ÉÏ£¬Õâ¸ö¼à¿ØÎļþÒ²¾ÍµÈÓÚ°ÚÉ裬·þÎñÆ÷¹ÒµôÁË£¬ËüÒ²ÎÞ·¨ÔËÐÐÁË£¬ÔõÃ´Ä ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ