ÔõôÔÚ΢ÇæÖÐ×°ÖÃThinkPHP²å¼þ
Ò»¡¢ÏÂÔØThinkPHP²å¼þ
ÔÚ×îÏÈʹÓÃThinkPHP²å¼þÇ°£¬ÎÒÃÇÓ¦¸ÃÏÈ´Ó¹ÙÍøÏÂÔØÆäѹËõ°ü£¬²¢½«Æä½âѹµ½ÍâµØĿ¼ÖС£½âѹºó£¬ÎÒÃÇ¿ÉÒÔ¿´µ½ÈçÏÂÎļþ½á¹¹£º
thinkphp/ ©À©¤library/ ©¦ ©¸©¤think/ ©¦ ©À©¤cache/ ©¦ ©À©¤console/ ©¦ ©À©¤controller/ ©¦ ©À©¤core/ ©¦ ©À©¤crypt/ ©¦ ©À©¤db/ ©¦ ©À©¤debug/ ©¦ ©À©¤di/ ©¦ ©À©¤event/ ©¦ ©À©¤exception/ ©¦ ©À©¤lang/ ©¦ ©À©¤middleware/ ©¦ ©À©¤model/ ©¦ ©À©¤paginator/ ©¦ ©À©¤session/ ©¦ ©À©¤template/ ©¦ ©À©¤validate/ ©¦ ©¸©¤.htaccess ©À©¤.htaccess ©À©¤.travis.yml ©À©¤composer.json ©À©¤composer.lock ©À©¤CONTRIBUTING.md ©À©¤LICENSE.txt ©À©¤README.md ©¸©¤think
µÇ¼ºó¸´ÖÆ
¶þ¡¢ÉÏ´«ThinkPHP²å¼þ
ÏÂÔØÍêThinkPHP²å¼þºó£¬ÎÒÃÇÐèÒª½«ÆäÉÏ´«µ½Î¢ÇæÖС£ÏêϸÀ´Ëµ£¬ÎÒÃÇÐèÒª½«thinkphpÎļþ¼Ð¸´ÖƵ½Î¢ÇæµÄaddonsĿ¼ÏµÄwxapp_thinkphp_pluginĿ¼ÖУ¬ÈçÏÂËùʾ£º
Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»
addons/ ©À©¤wxapp_thinkphp_plugin/ ©¦ ©¸©¤thinkphp/ ©¦ ©À©¤library/ ©¦ ©¦ ©¸©¤think/ ©¦ ©¦ ©À©¤cache/ ©¦ ©¦ ©À©¤console/ ©¦ ©¦ ©À©¤controller/ ©¦ ©¦ ©À©¤core/ ©¦ ©¦ ©À©¤crypt/ ©¦ ©¦ ©À©¤db/ ©¦ ©¦ ©À©¤debug/ ©¦ ©¦ ©À©¤di/ ©¦ ©¦ ©À©¤event/ ©¦ ©¦ ©À©¤exception/ ©¦ ©¦ ©À©¤lang/ ©¦ ©¦ ©À©¤middleware/ ©¦ ©¦ ©À©¤model/ ©¦ ©¦ ©À©¤paginator/ ©¦ ©¦ ©À©¤session/ ©¦ ©¦ ©À©¤template/ ©¦ ©¦ ©À©¤validate/ ©¦ ©¦ ©¸©¤.htaccess ©¦ ©À©¤.htaccess ©¦ ©À©¤.travis.yml ©¦ ©À©¤composer.json ©¦ ©À©¤composer.lock ©¦ ©À©¤CONTRIBUTING.md ©¦ ©À©¤LICENSE.txt ©¦ ©À©¤README.md ©¦ ©¸©¤think ©À©¤config.php ©À©¤install.php ©À©¤logo.png ©¸©¤plugin.php
µÇ¼ºó¸´ÖÆ
ÔÚÉÏ´«²å¼þºó£¬ÎÒÃÇÐèÒªÔÚ΢ÇæµÄ²å¼þÖÎÀíÒ³ÃæÉϾÙÐÐ×°Öòå¼þµÄ²Ù×÷¡£ÏêϸÀ´Ëµ£¬ÎÒÃÇÐèÒªµÇ¼΢Çæºǫ́£¬½øÈë²å¼þÖÎÀíÒ³Ã棬ÕÒµ½ÃûΪ¡°ThinkPHP²å¼þ¡±µÄ²å¼þ£¬²¢½«Æä¾ÙÐÐ×°Öá£
Èý¡¢Ê¹ÓÃThinkPHP²å¼þ
Ò»µ©×°ÖÃÁËThinkPHP²å¼þ£¬ÎÒÃDZã¿ÉÒÔÔÚ΢ÇæÖÐʹÓÃÆäËùÌṩµÄ¹¦Ð§¡£Í¨³£ÇéÐÎÏ£¬ÎÒÃÇ¿ÉÒÔÔÚ²å¼þµÄ¿ØÖÆÆ÷(Controller)Öнç˵ÏìÓ¦µÄÒªÁ죬ÒÔ¹©ÆäËûÄ£¿é»ò²å¼þʹÓá£ÀýÈ磬ÎÒÃÇ¿ÉÒÔÔÚ²å¼þµÄControllerÖнç˵ÈçÏÂÒªÁ죺
public function hello() { return 'hello,thinkphp'; }
µÇ¼ºó¸´ÖÆ
È»ºó£¬ÔÚÆäËûÄ£¿é»ò²å¼þµÄControllerÖУ¬¾Í¿ÉÒÔͨ¹ýÈçÏ·½·¨Å²ÓøÃÒªÁ죺
$thinkphpPlugin = $this->createPlugin('wxapp_thinkphp_plugin'); echo $thinkphpPlugin->hello();
µÇ¼ºó¸´ÖÆ
ÔÚŲÓÃcreatePluginÒªÁìʱ£¬ÎÒÃÇÐèÒªÖ¸¶¨¸ÃÒªÁìËùÊôµÄ²å¼þµÄĿ¼Ãû¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«ThinkPHP²å¼þµÄĿ¼ÃûÉèÖÃΪwxapp_thinkphp_plugin¡£
ÒÔÉϾÍÊÇÔõôÔÚ΢ÇæÖÐ×°ÖÃThinkPHP²å¼þµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡