Microengine application module secondary development documents and primary tutorial manual

01. The application module folder of Microengine is addons, and all Microengine application modules are in this folder.

02. The operating environment recommends PHP version 5.6 or above, mysql5.6, and the operating system is preferably Linux (centos).

03. Microengine allows public access to three files, namely root directory api.php (WeChat developer URL address), /web/index.php (computer terminal), /app/index.php (mobile terminal ).

04. The configuration information such as the database of Microengine is placed in the /data/config.php file.

05. In the manifest.xml configuration file of Microengine, the attribute value of direct should be set to 0, for example: <entry * direct="0">, if it is set to 1, it may appear that the identity verification is not passed. direct interview.

06. The WeChat developer URL address receives the data pushed by WeChat, and mainly uses the processor.php file to respond.

07.addons/zhiwu55com/template/*, under this folder are the module files on the computer side.

08. addons/zhiwu55com/template/mobile/*, the module files of the mobile phone are under this folder, for example: those page module files linked to the application entrance are all under this folder.

09. The data table of Microengine starts with ims_ by default.

10. Constant: IA_ROOT, microengine program installation directory, example value: D:/wwwroot/wwwzhiwu55cn, note: there is no slash at the end of the returned value.

11. Constant: ATTACHMENT_ROOT, microengine program attachment directory, example value: D:/wwwroot/wwwzhiwu55cn/attachment

12. Constant: MODULE_ROOT, current module directory, example value: D:/wwwroot/wwwzhiwu55cn/addons/hzw_zhiwu

13. When you need to import the include file, try to import it with IA_ROOT as the reference path, for example: include_once IA_ROOT .'/addons/wwwzhiwu55cn/inc/hzw.class.php'

14. $_W (uppercase W) is the most important global variable in the system. Many commonly used data in the microengine system are stored in this variable

15. $_GPC, global request variable, get GET, _GET,GE T , variables in_POST,CVariables in O O K I E S , namely _GPC=array_merge( GET , _GET,GET,_POST,$_COOKIES);

16. $_W['siteroot'], root directory of website URL, example value: http://www.zhiwu55.com/

17. $_W['siteurl'], original link, example value: http://www.zhiwu55.com/web/index.php?m=xxx&c=yyyy&do=hzw, that is, the address in the address bar of the current browser.

18. W [ ' page ' ] [ ' title ' ], the current page title, in the do W eb Z hiwu 55 ∗ ∗ ( ) function, by setting this variable, you can change the < title > _W[' of the current Microengine web page page']['title'], the title of the current page, in the doWebZhiwu55**() function, by setting this variable, you can change the <title> of the current Microengine web pageW[ ' p a g e ' ] [ ' t i t l e ' ] , current page title , in d o W e b Z h i w u 5 5( ) function , by setting this variable , you can change the _ _ _ _<title> _W['page']['title'] value.

19. W ['uniacid'], the current platform account U niacid, this variable is very important, the microengine can be opened more, so that countless official accounts can be accessed, mainly use _W['uniacid'], the current platform account Uniacid, this variable is very important, the micro engine can be opened more, so that countless public accounts can be accessed, mainly usingW[ ' u n i a c i d ' ] , the current platform account U n i a c i d , this variable is very important , we can open more microengines , so that countless public accounts can access , mainly use _ __W['uniacid'] to distinguish different official accounts.

20. $_W['container'], App mobile terminal platform terminal equipment, value range: wechat, android, ipad, iphone, ipod, unknown.

21. $_W['os'], App mobile terminal platform operating system, value range: windows (pc terminal), mobile (mobile terminal), unknown.

22. You can pass $_W['container']“wechat” && $_W[‘os’]"mobile", to strictly judge whether it is in the WeChat environment.

23. W ['openid'], the current fan user identifier, this is an important variable, the service number that has passed the general authentication can be obtained without feeling, in many functional scenarios, _W['openid'] is required, currently Fan user identifier, this is an important variable. Generally, the service account that has passed the authentication can be obtained without feeling. In many functional scenarios, it is requiredW[ ' o p e n i d ' ] , the current fan user identifier , this is an important variable , the service account that has passed the general authentication can be obtained without feeling , in In many functional scenarios , it is necessary to_W['openid'] value.

24. $_W['fans'], the current fan user information, city information, gender, time of following the official account, time of unfollowing the official account, etc. can be obtained from this variable.

25. $_W['jssdkconfig'], when sharing and forwarding on the App side, all the jssdk variables that need to be used are here.

26. To obtain the information of other fans of the official account, not the current fans, use mc_fansinfo( openid ), where openid), whereo p e n i d ) , where the variable openid is the openid of other fans of the official account

27. For the file site.php on the PC background of Microengine, all functions defined at the beginning of doWeb are functions of the computer.

28. For the file site.php on the mobile side of the Microengine App, all functions defined starting with doMobile are functions on the mobile side of the App.

29. Microengine is an MVC structure, use this − > create Mobile U rl ( ) and this->createMobileUrl() andthis>c r e a t e M o b i l e U r l ( ) and this->createWebUrl() to call and access the functions defined with doWeb** and doMobile in site.php

30. When forwarding and sharing the circle of friends on the App mobile phone WeChat, you need to use the complete URL path starting with http, use murl('entry', array('m'=>$this->modulename,'do'= >'zhiwu55_function_name'),true,true)

31. Microengine’s database operations are all prefixed with pdo_*, pdo_get('zhiwu55com', array('id >' => '55')), to obtain data with an id greater than 55, please note: before the id and > , there is an English space, which is a required space and cannot be omitted.

32. There are a total of database operation functions: pdo_get, pdo_getcolumn, pdo_getall, pdo_getslice, pdo_fetch, pdo_fetchcolumn, pdo_fetchall, pdo_insert, pdo_update, pdo_delete, pdo_query, pdo_run, pdo_fieldexists, pdo_indexexists, pdo_tableexists, pdo_fieldm atch,pdo_debug

33. Turn on "Console-Site Settings-Log Switch" in Weengine, and the data content pushed by Wechat to Weengine api.php can be viewed in the /data/logs/ log file.

34. In the microengine template file *.html, you can directly write the PHP source code, output curly braces and variables will not be escaped, use {##string##}

35.iseetcookie() writes the cookie value, after writing, you can use $_GPC to get it, and you can also use igetcookie() to get it.

36.authcode () string encryption or decryption function, this is a magical function. Different from base64_encode() and base64_decode() functions.

37. Add {template 'common/header'} to the top of the PC side and {template 'common/footer'} to the bottom

38. When using tpl_form_field_audio() or tpl_form_field_video() to upload multimedia files on the PC side, it is necessary to add the corresponding supporting file suffix file type in "Site Management - Attachment Settings - Audio and Video Attachment Settings".

39. If you want to debug SQL statements, you can use pdo_debug(); exit; it will print out all executed SQL statements for you to analyze and research.

40. When the user information cannot be obtained by using $_W, you can use mc_oauth_userinfo() to pop up a pop-up box that the user agrees to authorize the acquisition of information.

41. $_W['fans']['follow'] is used to judge whether the official account has been followed. If it is equal to 1, it means that the official account has been followed.

42. In the site.php file, you can use settings = settings =settings=this->module[‘config’]; s e t t i n g s [ ′ x x x x ′ ] = ′ y y y y y ′ ; settings['xxxx']='yyyyy'; settings[xxxx]=y y y y y ;this->saveSettings($settings); to modify the value in “Parameter Settings”.

43. To obtain the configuration information of the current official account in Microengine: pdo_get('uni_account', array('uniacid' => $_W['uniacid'])).

44. Use to obtain the appid of the official account: W [ ′ account ′ ] [ ′ key ′ ] , use to obtain the corresponding key: _W['account']['key'], use to obtain the corresponding key:W[account][key ],toobtainthecorrespondingkey:'account']['secret'].

45. If the value of $_W['account']['level'] is 4, it means that the current official account is a certified service account.

46. ​​When importing the jssdk address of WeChat, it is recommended not to add the http protocol name, and start with two slashes // directly, because if it is an https page, it is not allowed to load http files.

Guess you like

Origin blog.csdn.net/myqq155120699/article/details/109074440