thinkphpÔõÑùÔÚÇ°¶ËÊä³ö×¢²áÀÖ³ÉÐÅÏ¢
ÏÂÃæÎÒÃǽ«ÒÔÒ»¸ö¼òÆÓµÄ×¢ÊéÒ³ÃæΪÀý¾ÙÐÐÚ¹ÊÍ¡£ÎÒÃÇÐèÒªÏȽ¨ÉèÒ»¸ö±íµ¥£¬²¢½«Ëü°²ÅÅÓÚ register.html Ò³ÃæÖС£ÒÔÏÂÊÇ±íµ¥µÄ´úÂ룺
<form action="{:url(/help/&)}" method="post"> <label for="username">Óû§Ãû</label> <input type="text" id="username" name="username" /><br/> <label for="password">ÃÜÂë</label> <input type="password" id="password" name="password" /><br/> <label for="email">ÓÊÏä</label> <input type="email" id="email" name="email" /><br/> <button type="submit" name="submit">×¢²á</button> </form>
µÇ¼ºó¸´ÖÆ
ÔÚ±íµ¥ÖУ¬ÎÒÃÇÓ¦¸Ã×¢Öص½ÁË action ÊôÐÔÖеÄ{:url(/help/&)}£¬Ëü¸æËßϵͳÔÚÓû§µã»÷¡°×¢²á¡±°´Å¥ºó£¬½«Ìá½»±íµ¥Êý¾Ýµ½ºǫ́£¬Ê¹Óà register() ÒªÁì¾ÙÐд¦Àí¡£
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÔÚ User ¿ØÖÆÆ÷ÖоÙÐÐ×¢²áÂß¼µÄ±àд£¬´úÂëÈçÏ£º
namespace app\index\controller; use think\Controller; class User extends Controller { public function register() { $data = input('post.'); // Íê³É×¢²áÂß¼ $this->success('×¢²áÀÖ³É', 'User/login'); } }
µÇ¼ºó¸´ÖÆ
ÔÚ User ¿ØÖÆÆ÷µÄ register() ÒªÁìÖУ¬ÎÒÃÇÏÈ»ñÈ¡µ½Ò³Ãæͨ¹ý POST ÒªÁìת´ï¹ýÀ´µÄ²ÎÊý¡£È»ºó£¬ÎÒÃÇ¿ÉÒÔÔÚ´Ë´¦ÔËÐÐÍêÕûµÄ×¢²áÁ÷³Ì£¬°üÀ¨ÑéÖ¤Óû§ÐÅÏ¢¡¢Ð´ÈëÊý¾Ý¿âµÈ²Ù×÷¡£×îºó£¬ÎÒÃÇÀÖ³É×¢²áºó¿ÉÒÔͨ¹ý thinkphp ÄÚÖÃµÄ success ÒªÁìÏòÇ°¶ËÒ³ÃæÊä³öÐÅÏ¢¡£
Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
ͨ³£ÇéÐÎÏ£¬success ÒªÁìÓÃÓÚÔÚÖ´ÐÐÀֳɵIJÙ×÷ºó¾ÙÐÐÒ³ÃæÌøת¡£Òò´Ë£¬ÎÒÃǽ«»áÌøתÖÁµÇ¼ҳÃ棬ÈÃÓû§¼ÌÐøÏÂÒ»²½²Ù×÷¡£
ÒÔÉϾÍÊÇthinkphpÔõÑùÔÚÇ°¶ËÊä³ö×¢²áÀÖ³ÉÐÅÏ¢µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡