• 注册

人人商城函数之mobileUrl()用法-待整理

记录一下人人商城函数mobileUrl()的用法。

mobileUrl() 函数位置

ewei_shop/core/inc/functions.php

mobileUrl() 函数用法

在html模板中输出默认调用

所有订单

如果想要URL带参数,可用

进货单

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);
	}
}
 

发表评论 

我还是想用邮箱注册

登录

忘记密码 ?

用第三方帐号快捷登录

已有账户?前往登录吧~

注册