记录一下人人商城函数mobileUrl()的用法。
ewei_shop/core/inc/functions.php
以下VIP会员组可阅读此处隐藏内容
初级会员
[非卖]小伙伴
永久会员
请先登录并开通会员
登录
mobileUrl() 函数源码
if (!(function_exists('mobileUrl')))
{
function mobileUrl($do = '', $query = NULL, $full = false)
{
global $_W;
global $_GPC;
!($query) && ($query = array());
$dos = explode('/', trim($do));
$routes = array();
$routes[] = $dos[0];
if (isset($dos[1]))
{
$routes[] = $dos[1];
}
if (isset($dos[2]))
{
$routes[] = $dos[2];
}
if (isset($dos[3]))
{
$routes[] = $dos[3];
}
if (isset($dos[4]))
{
$routes[] = $dos[4];
}
$r = implode('.', $routes);
if (!(empty($r)))
{
$query = array_merge(array('r' => $r), $query);
}
$query = array_merge(array('do' => 'mobile'), $query);
$query = array_merge(array('m' => 'ewei_shop'), $query);
if (empty($query['mid']))
{
$mid = intval($_GPC['mid']);
if (!(empty($mid)))
{
$query['mid'] = $mid;
}
if (!(empty($_W['openid'])) && !(is_weixin()) && !(is_h5app()))
{
$myid = m('member')->getMid();
if (!(empty($myid)))
{
$member = pdo_fetch('select id,isagent,status from' . tablename('ewei_shop_member') . 'where id=' . $myid);
if (!(empty($member['isagent'])) && !(empty($member['status'])))
{
$query['mid'] = $member['id'];
}
}
}
}
if (empty($query['merchid']))
{
$merchid = intval($_GPC['merchid']);
if (!(empty($merchid)))
{
$query['merchid'] = $merchid;
}
}
else if ($query['merchid'] < 0)
{
unset($query['merchid']);
}
if (empty($query['liveid']))
{
$liveid = intval($_GPC['liveid']);
if (!(empty($liveid)))
{
$query['liveid'] = $liveid;
}
}
if ($full)
{
return $_W['siteroot'] . 'app/' . substr(murl('entry', $query, true), 2);
}
return murl('entry', $query, true);
}
}