LewaimaiUrl.php 761 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. class LewaimaiUrl {
  3. //创建当前环境下的url
  4. public static function createUrl($path, $param = NULL)
  5. {
  6. $url = "http://" . Yii::app()->request->getServerName() . Yii::app()->createUrl($path);
  7. if ($param && count($param) > 0)
  8. {
  9. $paramQuery = http_build_query($param);
  10. $url .= "&" . $paramQuery;
  11. }
  12. return $url;
  13. }
  14. //创建微信前端的url
  15. public static function createWeixinUrl($path, $param = NULL)
  16. {
  17. if (LEWAIMAI_DEBUG)
  18. {
  19. $url = "http://front.lewaimai.com.cn" . "/index.php?r=" . $path;
  20. }
  21. else
  22. {
  23. $url = "http://front.lewaimai.com" . "/index.php?r=" . $path;
  24. }
  25. if ($param && count($param) > 0)
  26. {
  27. $paramQuery = http_build_query($param);
  28. $url .= "&" . $paramQuery;
  29. }
  30. return $url;
  31. }
  32. }