Item::getUrl PHP Method

getUrl() public method

得到商品URL地址
public getUrl ( ) : string
return string the URL that shows the detail of the item
    public function getUrl()
    {
        if (F::utf8_str($this->title) == '1') {
            $title = str_replace('/', '-', $this->title);
        } else {
            $pinyin = new Pinyin($this->title);
            $title = $pinyin->full2();
            $title = str_replace('/', '-', $title);
        }
        return Yii::app()->createUrl('item/view', array('id' => $this->item_id, 'title' => $title));
    }

Usage Example

示例#1
0
 public function addItem(Item $item)
 {
     $loc = $item->getUrl();
     $lastmod = $item->getLastmod();
     $changefreq = $item->getChangefreq();
     $priority = $item->getPriority();
     $alternateLinks = $item->getAlternateMediaLinks();
     $this->add($loc, $lastmod, $changefreq, $priority);
     $this->addAlternateMediaLinks($alternateLinks);
 }
All Usage Examples Of Item::getUrl