當前位置: 首頁>>代碼示例>>PHP>>正文


PHP URL::domain方法代碼示例

本文整理匯總了PHP中URL::domain方法的典型用法代碼示例。如果您正苦於以下問題:PHP URL::domain方法的具體用法?PHP URL::domain怎麽用?PHP URL::domain使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在URL的用法示例。


在下文中一共展示了URL::domain方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: test4

 public function test4()
 {
     $url = "http://url.com/doc/index.php?query=1&query2=2#abc=3";
     $domain = URL::domain($url);
     //url.com
     $queryString = URL::queryString($url);
     //query=1&query=2
     $query = URL::query($url);
     //['query'=>1,'query2'=>2]
     $dir = URL::dir($url);
     //http://url.com/doc
     echo $domain;
     echo $queryString;
     print_r($query);
     echo $dir;
 }
開發者ID:rayful,項目名稱:url,代碼行數:16,代碼來源:Test.php

示例2: action_catetop

 /**
  * 設置分類封麵圖片
  */
 public function action_catetop()
 {
     $pid = (int) $this->getQuery('id');
     $cate_id = (int) $this->getQuery('cate_id');
     $info = DB::select('i.id', 'i.cate_id', 'i.picname', 'i.custom_name', 'i.disk_id', 'i.userid', 'i.click', 'i.is_share', 'd.disk_domain', 'cate.cate_name', array('i.disk_name', 'img_dir'))->from(array('imgs', 'i'))->join(array('img_disks', 'd'), 'LEFT')->on('d.disk_domain', '=', 'i.disk_id')->join(array('img_categories', 'cate'), 'LEFT')->on('cate.cate_id', '=', 'i.cate_id')->where('i.id', '=', $pid)->execute()->current();
     if (!empty($info)) {
         $img = URL::domain() . $this->thumb->create($info['img_dir'] . '/' . $info['picname'], 130, 130);
         DB::update('img_categories')->set(array('index_img' => $img, 'index_img_id' => $pid))->where('cate_id', '=', $cate_id)->execute();
         $this->request->redirect('/category/list?cate_id=' . $cate_id);
     }
     $this->auto_render = false;
 }
開發者ID:BGCX261,項目名稱:zhongyycode-svn-to-git,代碼行數:15,代碼來源:userpic.php

示例3: foreach

    </div>
    <div class="bd">

        <ul class="lists">
            <?php 
foreach ($recommend as $key => $item) {
    ?>
            <li>

                <a class="photo" href="/<?php 
    echo $item['id'];
    ?>
.html" target="photo">

                    <img src="<?php 
    echo URL::domain() . Str::changeLoad($thumb->create($item['img_dir'] . '/' . $item['picname'], 130, 130));
    ?>
" />
                </a>
                <span class="info">
                    <a class="photo_id" href="/<?php 
    echo $item['id'];
    ?>
.html" title="<?php 
    echo $item['custom_name'];
    ?>
"target="photo"><?php 
    echo Str::slice($item['custom_name'], 15, '...');
    ?>
</a><br />
                    會員:<?php 
開發者ID:BGCX261,項目名稱:zhongyycode-svn-to-git,代碼行數:31,代碼來源:index.php

示例4: action_zoom

 /**
  * 圖片集合
  */
 public function action_zoom()
 {
     $this->template->pid = $pid = (int) $this->getQuery('id');
     $this->template->zoom = $zoom = trim($this->getQuery('zoom'));
     $this->template->info = $info = ORM::factory('img')->select('imgs.*', 'u.username', 'd.disk_domain')->join(array('users', 'u'))->on('u.uid', '=', 'imgs.userid')->join(array('img_disks', 'd'))->on('d.disk_domain', '=', 'imgs.disk_id')->where('imgs.id', '=', (int) $pid)->find();
     if (empty($info->picname)) {
         $this->show_message('非法訪問', 0, array(), true);
     }
     $url = URL::domain();
     $picname = $info->disk_name . '/' . $info->picname;
     $imRule = Str::changeLoad($picname, true);
     if ($zoom == 'medium') {
         $picname = $this->thumb->create($picname, 640, 640, 's');
         $imRule = Str::changeLoad($picname);
     } elseif ($zoom == 'thumb') {
         $picname = $this->thumb->create($picname, 130, 130);
         $imRule = Str::changeLoad($picname);
     }
     $this->template->picinfo = $picinfo = @getimagesize($picname);
     $this->template->picname = $url . $imRule;
 }
開發者ID:BGCX261,項目名稱:zhongyycode-svn-to-git,代碼行數:24,代碼來源:pic.php

示例5: date

?>
</h2>
        <div class="clearfloat"></div>
        <span class="upload_time" style="float:left;">上傳用戶:【<?php 
echo $imgInfo['username'];
?>
】 上傳於<?php 
echo date('Y-m-d', $imgInfo['uploadtime']);
?>
 </span><span class="back"><a href="javascript:" onclick="report(this);">舉報</a><a href="/">返回首頁</a> </span> </div>
        <div class="clearfloat"></div>
        <div style="border-bottom:4px solid #85C64E;"></div>
      <div class="pic">
      <br />
      <img src="<?php 
echo URL::domain() . Str::changeLoad($thumb->create($imgInfo['img_dir'] . '/' . $imgInfo['picname'], 640, 640, 's'));
?>
"  alt="<?php 
echo $imgInfo['custom_name'];
?>
"/><br />
          <br />
         <a class="img" href="/pic/zoom?id=<?php 
echo $imgInfo['id'];
?>
">查看原圖 </a> </div>
    </div>
    <div class="comment">
      <div class="title">
        <h2>留言評論</h2>
        <sub>+Message&nbsp;comment</sub> </div>
開發者ID:BGCX261,項目名稱:zhongyycode-svn-to-git,代碼行數:31,代碼來源:view.php

示例6: foreach

        <ul class="back">
          <li><a href="/">返回首頁</a></li>
        </ul>
      </div>
      <div class="bd">
        <ul class="lists">
         <?php 
foreach ($pagination as $k => $img) {
    ?>
          <li style="height:200px;">
              <a class="photo" href="/<?php 
    echo $img['id'];
    ?>
.html" target="photo" style="height:130px; width:130px;">
                  <img src="<?php 
    echo URL::domain() . Str::changeLoad($thumb->create($img['disk_name'] . '/' . $img['picname'], 130, 130));
    ?>
" />
               </a>
              <span class="info"> <a class="photo_id" href="/<?php 
    echo $img['id'];
    ?>
.html" title='查看圖片詳情'><?php 
    echo Str::slice($img['custom_name'], 15, '...');
    ?>
</a><br />
            <strong>&nbsp;瀏覽<?php 
    echo $img['click'];
    ?>
次</strong> </span> </li>
開發者ID:BGCX261,項目名稱:zhongyycode-svn-to-git,代碼行數:30,代碼來源:person.php

示例7: _calculate_source

 /**
  * Return the formatted source as a link or text.
  * 
  * @param HTML_MUNGER $munger The transformation context.
  * @param string[] $attrs
  * @param string $href
  * @return string
  * @access private
  */
 protected function _calculate_source($munger, $attrs, $href)
 {
     $Result = $munger->apply_non_html_converters($this->_read_attribute($attrs, 'source'));
     if ($Result && $href) {
         $url = new URL($href);
         $domain = $url->domain();
         $Result = "<a href=\"http://{$domain}/\">{$Result}</a>";
     }
     return $Result;
 }
開發者ID:mvonballmo,項目名稱:earthli-webcore,代碼行數:19,代碼來源:html_munger.php

示例8: _test_url_class

 protected function _test_url_class()
 {
     $url_text = 'http://earthli.com/pages/page.php?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/';
     $this->_log('original URL', Msg_type_info);
     $url = new URL($url_text);
     $this->_check_equal('http://earthli.com/pages/page.php?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('page.php', $url->name());
     $this->_check_equal('php', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('page', $url->name_without_extension());
     $this->_check_equal('page.php?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $this->_log('replaced extension', Msg_type_info);
     $url->replace_extension('jpg');
     $this->_check_equal('http://earthli.com/pages/page.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('page.jpg', $url->name());
     $this->_check_equal('jpg', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('page', $url->name_without_extension());
     $this->_check_equal('page.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $this->_log('appended to name', Msg_type_info);
     $url->append_to_name('_tn');
     $this->_check_equal('http://earthli.com/pages/page_tn.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('page_tn.jpg', $url->name());
     $this->_check_equal('jpg', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('page_tn', $url->name_without_extension());
     $this->_check_equal('page_tn.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $this->_log('replaced name', Msg_type_info);
     $url->replace_name('picture');
     $this->_check_equal('http://earthli.com/pages/picture.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('picture.jpg', $url->name());
     $this->_check_equal('jpg', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('picture', $url->name_without_extension());
     $this->_check_equal('picture.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $this->_log('emptied name and extension', Msg_type_info);
     $url->replace_name_and_extension('');
     $this->_check_equal('http://earthli.com/pages/?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('', $url->name());
     $this->_check_equal('', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('', $url->name_without_extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $url->replace_name_and_extension('picture.jpg');
     $this->_check_equal('http://earthli.com/pages/picture.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('picture.jpg', $url->name());
     $this->_check_equal('jpg', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('picture', $url->name_without_extension());
     $this->_check_equal('picture.jpg?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $this->_log('replaced name and extension', Msg_type_info);
     $url->replace_name_and_extension('picture_ex.png');
     $this->_check_equal('http://earthli.com/pages/picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('picture_ex.png', $url->name());
     $this->_check_equal('png', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->query_string());
     $this->_check_equal('picture_ex', $url->name_without_extension());
     $this->_check_equal('picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/', $url->name_with_query_string());
     $this->_log('added argument', Msg_type_info);
     $url->add_argument('arg4', 'new');
     $this->_check_equal('http://earthli.com/pages/picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('picture_ex.png', $url->name());
     $this->_check_equal('png', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->query_string());
     $this->_check_equal('picture_ex', $url->name_without_extension());
     $this->_check_equal('picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->name_with_query_string());
     $this->_log('replaced argument', Msg_type_info);
     $url->replace_argument('arg2', 'not_2');
     $this->_check_equal('http://earthli.com/pages/picture_ex.png?arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->as_text());
     $this->_check_equal('earthli.com', $url->domain());
     $this->_check_equal('http://earthli.com/pages/', $url->path());
     $this->_check_equal('/pages/', $url->path_without_domain());
     $this->_check_equal('picture_ex.png', $url->name());
     $this->_check_equal('png', $url->extension());
     $this->_check_equal('arg1=http://earthli.com/pages/page.php&arg2=not_2&arg3=user|7d9c2dae9b5b69cbbbdea47f99574ba8/&arg4=new', $url->query_string());
     $this->_check_equal('picture_ex', $url->name_without_extension());
//.........這裏部分代碼省略.........
開發者ID:mvonballmo,項目名稱:earthli-webcore,代碼行數:101,代碼來源:url_tests.php

示例9: action_saveimg

 /**
  * 自動遠程保存圖片
  *
  */
 public function action_saveimg()
 {
     $source = $this->getQuery('src');
     if (!URL::ping($source)) {
         echo $source;
         die;
     }
     $savePath = "books_img/" . $this->auth['uid'] . '/';
     Io::mkdir(DOCROOT . $savePath);
     $data = @file_get_contents($source);
     $filename = basename($source);
     $extension = strtolower(strtolower(substr(strrchr($filename, '.'), 1)));
     $saveName = str_replace('.', '', microtime(true)) . '.' . $extension;
     // 保存的文件名
     $filename = $savePath . $saveName;
     $filesize = @file_put_contents(DOCROOT . $filename, $data);
     //保存文件,返回文件的size
     if ($filesize == 0) {
         //保存失敗
         @unlink($savefile);
         throw new Exception('文件保存到本地目錄時失敗');
     }
     list($w, $h, $t) = getimagesize(DOCROOT . $filename);
     $filetype = image_type_to_mime_type($t);
     if (!preg_match('/^image\\/.+/i', $filetype)) {
         throw new Exception('轉存文件並非有效的圖片文件');
     }
     $filename = $this->thumb->create($filename, 640, 640);
     echo URL::domain() . $filename;
     $this->auto_render = false;
 }
開發者ID:BGCX261,項目名稱:zhongyycode-svn-to-git,代碼行數:35,代碼來源:article.php

示例10: action_add

 /**
  * 添加專題
  *
  */
 public function action_add()
 {
     $this->checklogin();
     $this->template->pageTitle = '添加專題';
     $this->_add_css('styles/album/add_topics.css');
     $this->_add_script('scripts/copy.js');
     $specialpic = ORM::factory('specialpic');
     if ($this->isPost()) {
         $post = Validate::factory($this->getPost())->filter(TRUE, 'trim')->rule('title', 'not_empty')->rule('content', 'not_empty');
         if ($post->check()) {
             $specialpic->values($post);
             $specialpic->uid = $this->auth['uid'];
             $specialpic->save();
             $specialpic->sid;
             // 添加專題標簽
             $tag = new Tags();
             $tags = trim($this->getPost('tags'));
             $tags = explode(' ', $tags);
             $tag->add($specialpic->sid, 'img_subject', $tags, $this->auth['uid']);
             $links[] = array('text' => '返回專題列表', 'href' => '/picsubject/list');
             $this->show_message('發現專題圖片操作成功。', 1, $links, true);
         } else {
             // 校驗失敗,獲得錯誤提示
             $str = '';
             $this->template->registerErr = $errors = $post->errors('default/pic/pic');
             foreach ($errors as $item) {
                 $str .= $item . '<br>';
             }
             $this->show_message($str);
         }
     }
     $pid = $this->getQuery('id');
     $arr = explode('-', $pid);
     $select = DB::select('imgs.picname', 'imgs.userid', 'imgs.custom_name', 'd.disk_domain', 'd.disk_name', array('imgs.disk_name', 'img_dir'))->from('imgs')->join(array('img_disks', 'd'))->on('d.disk_domain', '=', 'imgs.disk_id')->where('imgs.id', 'in', $arr)->where('imgs.userid', '=', $this->auth['uid']);
     $rows = $select->execute()->as_array();
     $str = '';
     foreach ($rows as $item) {
         $temp_img = $item['img_dir'] . '/' . $item['picname'];
         list($width, $height) = getimagesize($temp_img);
         if ($width >= 640) {
             $temp_img = $this->thumb->create($temp_img, 640, 640, 's');
             $temp_img = Str::changeLoad($temp_img, false);
         } else {
             $temp_img = Str::changeLoad($temp_img, true);
         }
         $str .= '<p>' . "<img src=\"" . URL::domain() . $temp_img . '" alt="' . $item['custom_name'] . '"/></p><p style="text-align:center;">' . $item['custom_name'] . '</p>';
     }
     $this->template->content = $str;
 }
開發者ID:BGCX261,項目名稱:zhongyycode-svn-to-git,代碼行數:53,代碼來源:picsubject.php


注:本文中的URL::domain方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。