コード例 #1
0
ファイル: controller.php プロジェクト: jasonhzy/fx_demo
 /**
  *
  * @param mixed $mothods
  * @param array $parms
  * @return string
  * @access public
  */
 function &__url($mothods = array(), $parms = array())
 {
     $siteurl = Basic::siteurl();
     if (is_object($mothods)) {
         $mod = $this->__module;
         $fun = $this->__function;
         $url = $siteurl . '/' . ($mod != 'page' ? $mod . '/' : "") . ($fun != 'index' ? $fun . '/' : "") . ($this->__parms ? implode('/', $this->__parms) : '');
     } else {
         if (is_string($mothods)) {
             if ($mothods == '') {
                 $url = $siteurl;
             } else {
                 if (eregi('http://|https://', $mothods)) {
                     $url = $mothods;
                 } else {
                     $url = $siteurl . '/' . $mothods;
                 }
             }
         } else {
             if (empty($mothods)) {
                 $url = $siteurl;
             } else {
                 //数组
                 //$mothods = array_map('urldecode', $mothods);
                 // $mothods = array_map('urlencode', $mothods);
                 // $url = $siteurl.'/'.implode('/', $mothods);
                 foreach ($mothods as $k => $val) {
                     if ($val == 'page' || $val == 'index') {
                         continue;
                     }
                     $_mothods[$k] = urlencode(urldecode($val));
                 }
                 unset($mothods);
                 $url = $siteurl . '/' . implode('/', $_mothods) . '/';
             }
         }
     }
     if (!empty($parms)) {
         if (is_array($parms)) {
             foreach ($parms as $name => $value) {
                 $gets[$name] = "{$name}={$value}";
             }
             $url .= '?' . implode('&', $gets);
         } else {
             $url .= '?' . $parms;
         }
     }
     $url = eregi_replace('[/]+', '/', $url);
     $url = eregi_replace('http:/', 'http://', $url);
     return $url;
 }
コード例 #2
0
 function class_url()
 {
     return Basic::siteurl();
 }
コード例 #3
0
 function __construct()
 {
     $this->__siteurl = Basic::siteurl();
 }