thinkphpÄ£°åÎļþÔÚÄÇÀïÒýÓÃ
thinkphpÊÇÒ»¸ö»ùÓÚmvcÍ·ÄԵĿªÔ´php¿ò¼Ü£¬Í¨¹ýËü¿ÉÒÔ¿ìËٵؾÙÐÐwebÓ¦ÓóÌÐòµÄ¿ª·¢¡£ÔÚthinkphpµÄ¿ª·¢Àú³ÌÖУ¬Ê¹ÓÃÄ£°åÎļþÊǺܳ£¼ûµÄ¡£±¾ÎĽ«»áÏÈÈÝthinkphpÄ£°åÎļþµÄÒýÓÃλÖá£
Ò»Ñùƽ³£¶øÑÔ£¬ThinkPHPµÄÄ£°åÎļþ¶¼Î»ÓÚÏîĿĿ¼ÏµÄ/application/Ä£¿éÃû/view/¿ØÖÆÆ÷ÃûĿ¼ÄÚ¡£ÆäÖУ¬Ä£¿éÃûÊÇÖ¸Ó¦ÓóÌÐò°´¹¦Ð§»òÓªÒµ»®·ÖµÄÄ£¿é£¬¿ØÖÆÆ÷ÃûÔò¶ÔÓ¦ÓÚÄ£¿éÄÚµÄÏêϸ¿ØÖÆÆ÷¡£
ÔÚ¿ØÖÆÆ÷ÄÚ£¬¿ÉÒÔʹÓÃViewÀàµÄfetchÒªÁìÀ´äÖȾģ°åÎļþ£¬ÀýÈ磺
public function index() { $this->assign([ 'name' => 'Bob', 'age' => 20, ]); return $this->fetch('index'); }
µÇ¼ºó¸´ÖÆ
ÔÚ´Ë´úÂëƬ¶ÏÖУ¬assignÒªÁìÓÃÓÚÏòÄ£°åÎļþÖÐת´ïÊý¾Ý£¬fetchÒªÁìÖеÄ×Ö·û´®²ÎÊý’index’ÔòÌåÏÖÒªäÖȾµÄÄ£°åÎļþÃû£¬¼´/application/Ä£¿éÃû/view/¿ØÖÆÆ÷Ãû/index.html¡£
³ýÁËʹÓÃfetchÒªÁìÍ⣬»¹¿ÉÒÔʹÓÃViewÀàµÄÆäËûÒªÁìÀ´´¦ÀíÄ£°åÎļþ¡£ÀýÈ磺
Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
displayÒªÁ죺ֱ½ÓÊä³öÄ£°åÎļþ
assignÒªÁ죺ÏòÄ£°åÎļþÖÐת´ïÊý¾Ý
existsÒªÁ죺ÅжÏÄ£°åÎļþÊÇ·ñ±£´æ
filterContentÒªÁ죺¶ÔÄ£°åÎļþ¾ÙÐйýÂË´¦Àí
×ÜÖ®£¬ThinkPHPÄ£°åÎļþµÄλÖÃÔÚ/application/Ä£¿éÃû/view/¿ØÖÆÆ÷ÃûĿ¼ÄÚ£¬¿ÉÒÔʹÓÃViewÀàµÄÒªÁì¾ÙÐÐÒýÓúʹ¦Àí¡£
ÒÔÉϾÍÊÇthinkphpÄ£°åÎļþÔÚÄÇÀïÒýÓõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡