全局变量
本文整理于网络,仅供阅读参考,如有不妥之处,敬请批评指正!如果您想加入微擎社区版技术大牛微信群和QQ群,请联系微信: ccccyyyy4444 或者 QQ:155120699
MODULE_URL
指向模块目录的URL地址,
示例
class We7_testWebAppModuleWebapp extends WeModuleWebapp {
public function doPageMybind() {
echo MODULE_URL;
//输出值 http://pro.we7.cc/addons/we7_testwebapp/
}
}
在模板中引用模块中的CSS文件
<link rel="stylesheet" href="{MODULE_URL}template/web/image/style.css" />
MODULE_ROOT
指向模块目录的物理绝对路径
示例
class We7_testWebAppModuleWebapp extends WeModuleWebapp {
public function doPageMybind() {
echo MODULE_ROOT;
//输出值 /www/htdocs/weengine/prox/addons/we7_testwebapp
}
}
$_W[‘current_module’]
输出当前模块的信息
示例
global $_W;
print_r($_W['current_module']);
Array
(
[mid] => 模块ID
[name] => we7_testwebapp
[type] => services
[title] => webapp测试
[title_initial] => W
[version] => 1.0
[ability] => webapp测试
[desc<x>ription] => webapp测试
[author] => we7team
[url] =>
[settings] => 0
[subscribes] => Array
(
[0] => text
[1] => image
[2] => voice
[3] => video
[4] => shortvideo
[5] => location
[6] => li<x>nk
[7] => subscribe
[8] => unsubscribe
[9] => qr
[10] => trace
[11] => click
[12] => view
[13] => merchant_order
)
[handles] => Array
(
[0] => text
)
[isrulefields] => 0
[issystem] => 0
[target] => 0
[iscard] => 1
[permissions] => a:0:{}
[wxapp_support] => 1
[app_support] => 2
[webapp_support] => 2
[welcome_support] => 1
[oauth_type] => 1
[id] =>
[modulename] =>
[isdisplay] => 1
[logo] => http://pro.we7.cc/addons/we7_testwebapp/icon.jpg?v=1514181251
[main_module] =>
[plugin_list] => Array
(
)
[is_relation] =>
[config] => Array //模块的配置信息,如果启用 settings 后,
(
)
[enabled] => 1
[shortcut] =>
)
如果看不懂微擎社区版二次开发手册或者遇到问题,请联系微信: ccccyyyy4444 或者 QQ:155120699 ,如果我们有空闲时间,可以免费为您答疑解惑。