第一步: 在你的微擎零碎addons文件夹上面,新建一个目录,命名为:zhiwu55_cn,这个就是微擎模块利用的标识,类拟人的身份证号一样,如下图所示。
第二步: 方才新建的zhiwu55_cn目录上面,创立template、manifest.xml、site.php这三个文件,其中icon.jpg图标可选,不要也能够,如下图所示。
第三步: 编写微擎利用模块的配置文件manifest.xml,内容如下:
<?xml version="1.0" encoding="utf-8"?><manifest xmlns="https://www.w7.cc/" versionCode=""> <application setting='false'> <name><![CDATA[收费下载微擎利用]]></name> <identifie><![CDATA[zhiwu55_cn]]></identifie> <version><![CDATA[1.0.0]]></version> <ability><![CDATA[收费下载微擎利用]]></ability> <type><![CDATA[activity]]></type> <description><![CDATA[收费下载微擎利用]]></description> <author><![CDATA[w7]]></author> <url><![CDATA[]]></url> <setting><![CDATA[]]></setting> </application> <platform> <subscribes> </subscribes> <handles> <message type="text" /> </handles> <rule embed="false" /> <card embed="false" /> <supports> <item type="app" /> <item type="wxapp" /> <item type="webapp" /> </supports> </platform> <bindings> <menu> <entry title="微擎模块" do="Zhiwu55comAll" icon="fa fa-hand-o-right animated flash infinite" state="" direct="1" displayorder="1" /> </menu> <shortcut> </shortcut> </bindings> <install> <![CDATA[]]> </install> <uninstall> <![CDATA[]]> </uninstall> <upgrade> <![CDATA[]]> </upgrade></manifest>
第四步: 编写微擎的后盾管理文件site.php文件,内容如下:
<?phpdefined('IN_IA') or exit('Access Denied');class zhiwu55_cnModuleSite extends WeModuleSite { public function doWebZhiwu55comAll() { global $_W, $_GPC; $uniaccount = array(); $uniaccount = pdo_get('uni_account', array('uniacid' => $_W['uniacid'])); if(empty($uniaccount['name'])) { $myname='微擎模块'; } else { $myname=$uniaccount['name']; } $siteUrl=base64_decode("aHR0cDovL3c3LmRlbW8uemhpd3U1NS5jb20="); if(empty($uniaccount['logo'])) { $logoUrl=$siteUrl.'/attachment/headimg_2.jpg'; } else { $logoUrl=tomedia($uniaccount['logo']); } load()->func('communication'); $dataArr=ihttp_get($siteUrl.'/data.php'); $dataStr=$dataArr['content']; $dataStr=base64_decode($dataStr); $dataArr=iunserializer($dataStr); include $this->template("Zhiwu55comAll"); }}
第五步: 编写site.php文件中,有一个doWebZhiwu55comAll()函数,蕴含了Zhiwu55comAll模板文件,位于template文件夹上面,创立一个Zhiwu55comAll.html模板文件,如下图所示。
第六步: 关上template文件夹上面的Zhiwu55comAll.html文件,编写内容如下
{template 'common/header'}<style>a.hzw-link:hover { border: 1px solid red; box-shadow: 0 0 6px 1px red;}.hzw-link { width: 180px; margin: 10px; float: left; text-align: center;}</style>{loop $dataArr $item}<a href="{$siteUrl}/web/index.php?c=module&a=welcome&module_name={$item['module_id']}&uniacid=2" class="panel panel-default hzw-link" target="_blank"> <div class="panel-body"> <img src="{$siteUrl}/addons/{$item['module_id']}/icon.jpg" style="width:80%;height:auto;"/> </div> <div class="panel-footer">{$item['module_name']} </div></a>{/loop}{template 'common/footer'}
第七步: 进入微擎后盾零碎,在“利用治理 -- 未装置列表”那里,找到这个模块利用,点击装置即可,如下图所示。
第八步: 这个简略的模块开发实现,进入这个模块,能够看到很多微擎利用,还能够点击进去体验,如下图所示。
总结: 下面只是展现了微擎模块利用开发最简略的胜利实例,只有肯入手,一步一步跟着教程做,不论有没有根底,任何人都能够实现这个微擎模块的开发,让大家能第一工夫看到和感触到入手劳动之后的成绩,通过下面的实例,咱们能够分明理解到微擎模块的运行机制,当作本人钻研微擎模块利用的入门教程。