当前位置: 首页>>代码示例>>PHP>>正文


PHP Net_URL::getQueryString方法代码示例

本文整理汇总了PHP中Net_URL::getQueryString方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_URL::getQueryString方法的具体用法?PHP Net_URL::getQueryString怎么用?PHP Net_URL::getQueryString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Net_URL的用法示例。


在下文中一共展示了Net_URL::getQueryString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isset

    /**
    * Builds the request string
    *
    * @access private
    * @return string The request string
    */
    function _buildRequest()
    {
        $separator = ini_get('arg_separator.output');
        ini_set('arg_separator.output', '&');
        $querystring = ($querystring = $this->_url->getQueryString()) ? '?' . $querystring : '';
        ini_set('arg_separator.output', $separator);

        $host = isset($this->_proxy_host) ? $this->_url->protocol . '://' . $this->_url->host : '';
        $port = (isset($this->_proxy_host) AND $this->_url->port != 80) ? ':' . $this->_url->port : '';
        $path = $this->_url->path . $querystring;
        $url  = $host . $port . $path;

        if (!strlen($url)) {
            $url = '/';
        }

        $request = $this->_method . ' ' . $url . ' HTTP/' . $this->_http . "\r\n";

        if (in_array($this->_method, $this->_bodyDisallowed) ||
            (0 == strlen($this->_body) && (HTTP_REQUEST_METHOD_POST != $this->_method ||
             (empty($this->_postData) && empty($this->_postFiles)))))
        {
            $this->removeHeader('Content-Type');
        } else {
            if (empty($this->_requestHeaders['content-type'])) {
                // Add default content-type
                $this->addHeader('Content-Type', 'application/x-www-form-urlencoded');
            } elseif ('multipart/form-data' == $this->_requestHeaders['content-type']) {
                $boundary = 'HTTP_Request_' . md5(uniqid('request') . microtime());
                $this->addHeader('Content-Type', 'multipart/form-data; boundary=' . $boundary);
            }
        }

        // Request Headers
        if (!empty($this->_requestHeaders)) {
            foreach ($this->_requestHeaders as $name => $value) {
                $canonicalName = implode('-', array_map('ucfirst', explode('-', $name)));
                $request      .= $canonicalName . ': ' . $value . "\r\n";
            }
        }

        // No post data or wrong method, so simply add a final CRLF
        if (in_array($this->_method, $this->_bodyDisallowed) || 
            (HTTP_REQUEST_METHOD_POST != $this->_method && 0 == strlen($this->_body))) {

            $request .= "\r\n";

        // Post data if it's an array
        } elseif (HTTP_REQUEST_METHOD_POST == $this->_method && 
                  (!empty($this->_postData) || !empty($this->_postFiles))) {

            // "normal" POST request
            if (!isset($boundary)) {
                $postdata = implode('&', array_map(
                    create_function('$a', 'return $a[0] . \'=\' . $a[1];'), 
                    $this->_flattenArray('', $this->_postData)
                ));

            // multipart request, probably with file uploads
            } else {
                $postdata = '';
                if (!empty($this->_postData)) {
                    $flatData = $this->_flattenArray('', $this->_postData);
                    foreach ($flatData as $item) {
                        $postdata .= '--' . $boundary . "\r\n";
                        $postdata .= 'Content-Disposition: form-data; name="' . $item[0] . '"';
                        $postdata .= "\r\n\r\n" . urldecode($item[1]) . "\r\n";
                    }
                }
                foreach ($this->_postFiles as $name => $value) {
                    if (is_array($value['name'])) {
                        $varname       = $name . ($this->_useBrackets? '[]': '');
                    } else {
                        $varname       = $name;
                        $value['name'] = array($value['name']);
                    }
                    foreach ($value['name'] as $key => $filename) {
                        $fp   = fopen($filename, 'r');
                        $data = fread($fp, filesize($filename));
                        fclose($fp);
                        $basename = basename($filename);
                        $type     = is_array($value['type'])? @$value['type'][$key]: $value['type'];

                        $postdata .= '--' . $boundary . "\r\n";
                        $postdata .= 'Content-Disposition: form-data; name="' . $varname . '"; filename="' . $basename . '"';
                        $postdata .= "\r\nContent-Type: " . $type;
                        $postdata .= "\r\n\r\n" . $data . "\r\n";
                    }
                }
                $postdata .= '--' . $boundary . "--\r\n";
            }
            $request .= 'Content-Length: ' .
                        (HTTP_REQUEST_MBSTRING? mb_strlen($postdata, 'iso-8859-1'): strlen($postdata)) .
                        "\r\n\r\n";
//.........这里部分代码省略.........
开发者ID:rkern21,项目名称:videoeditor,代码行数:101,代码来源:Request.php

示例2: send

 /**
  * Send a pingback.
  *
  * @param array $data (optional) An array of pingback data.
  *
  * @access public
  * @see autodiscover()
  */
 function send($data = null)
 {
     if ($data !== null) {
         $res = $this->setFromArray($data);
         if (PEAR::isError($res)) {
             return $res;
         }
     }
     // Find the whether if source and target is equal or not.
     if (strstr($this->_data['sourceURI'], $this->_data['targetURI'])) {
         return PEAR::raiseError('Target URI is equal with source URI');
     }
     // pingback URI set
     if (empty($this->_data['pingbackURI'])) {
         $res = Services_Pingback::autodiscover($this->_data['targetURI']);
         if (PEAR::isError($res)) {
             return $res;
         } else {
             if (empty($res)) {
                 return PEAR::raiseError('Target URI is not a pingback-enabled resource');
             }
         }
         $this->_data['pingbackURI'] = $res;
     }
     // Prepare an XML-RPC Message.
     $eArgs = array(XML_RPC_encode($this->_data['sourceURI']), XML_RPC_encode($this->_data['targetURI']));
     $msg = new XML_RPC_Message('pingback.ping', $eArgs);
     // Prepare full path of URI to conforms XML_RPC_Client parameter.
     $url = new Net_URL($this->_data['pingbackURI']);
     $path = $url->path;
     $querystring = $url->getQueryString();
     if (!empty($querystring)) {
         $path .= '?' . $querystring;
     }
     $cli = new XML_RPC_Client($path, $url->protocol . '://' . $url->host, $url->port);
     $cli->setDebug((int) $this->_options['debug']);
     // save the current error handling in buffer for restore.
     $default_error_mode = $GLOBALS['_PEAR_default_error_mode'];
     $default_error_options = $GLOBALS['_PEAR_default_error_options'];
     // Set error mode to callback, since XML_RPC doesn't return error object on failure.
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'XML_RPC_ErrorCallback'));
     $res = $cli->send($msg, (int) $this->_options['timeout']);
     // Cacth the error if any.
     if ($this->_isXML_RPC_Error()) {
         return $this->_XML_RPC_Error;
     }
     $val = $res->value();
     if (!is_object($val) || !is_a($val, 'XML_RPC_value')) {
         return PEAR::raiseError('Response Error: ' . $res->faultString());
     }
     // restore the current error handling.
     PEAR::setErrorHandling($default_error_mode, $default_error_options);
     return XML_RPC_decode($val);
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:62,代码来源:Pingback.php

示例3: mobileProcess


//.........这里部分代码省略.........
     if (empty($arrCategory_id)) {
         $arrCategory_id = array("0");
     }
     if ($_GET['mode'] == 'search') {
         $tpl_subtitle = "検索結果";
         $tpl_search_mode = true;
     } elseif (empty($arrCategory_id)) {
         $tpl_subtitle = "全商品";
     } else {
         $arrFirstCat = $objDb->sfGetFirstCat($arrCategory_id[0]);
         $tpl_subtitle = $arrFirstCat['name'];
     }
     $objQuery = new SC_Query();
     $count = $objQuery->count("dtb_best_products", "category_id = ?", $arrCategory_id);
     // 以下の条件でBEST商品を表示する
     // ・BEST最大数の商品が登録されている。
     // ・カテゴリIDがルートIDである。
     // ・検索モードでない。
     if ($count >= BEST_MIN && $this->lfIsRootCategory($arrCategory_id[0]) && $_GET['mode'] != 'search') {
         // 商品TOPの表示処理
         $this->arrBestItems = SC_Utils_Ex::sfGetBestProducts($conn, $arrCategory_id[0]);
         $this->BEST_ROOP_MAX = ceil((BEST_MAX - 1) / 2);
     } else {
         if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0) {
             // 検索時にcategory_idがGETに存在しない場合は、仮に埋めたIDを空白に戻す
             $arrCategory_id = array("");
         }
         // 商品一覧の表示処理
         $this->lfDispProductsList($arrCategory_id[0], $_GET['name'], $this->disp_number, $_REQUEST['orderby']);
         // 検索条件を画面に表示
         // カテゴリー検索条件
         if (strlen($_GET['category_id']) == 0) {
             $arrSearch['category'] = "指定なし";
         } else {
             $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?", array($category_id));
             $arrSearch['category'] = $arrCat;
         }
         // 商品名検索条件
         if ($_GET['name'] === "") {
             $arrSearch['name'] = "指定なし";
         } else {
             $arrSearch['name'] = $_GET['name'];
         }
     }
     if ($_POST['mode'] == "cart" && $_POST['product_id'] != "") {
         // 値の正当性チェック
         if (!SC_Utils_Ex::sfIsInt($_POST['product_id']) || !SC_Utils_Ex::sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) {
             SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND, "", false, "", true);
         } else {
             // 入力値の変換
             $this->arrErr = $this->lfCheckError($_POST['product_id']);
             if (count($this->arrErr) == 0) {
                 $objCartSess = new SC_CartSession();
                 $classcategory_id = "classcategory_id" . $_POST['product_id'];
                 $classcategory_id1 = $_POST[$classcategory_id . '_1'];
                 $classcategory_id2 = $_POST[$classcategory_id . '_2'];
                 $quantity = "quantity" . $_POST['product_id'];
                 // 規格1が設定されていない場合
                 if (!$this->tpl_classcat_find1[$_POST['product_id']]) {
                     $classcategory_id1 = '0';
                 }
                 // 規格2が設定されていない場合
                 if (!$this->tpl_classcat_find2[$_POST['product_id']]) {
                     $classcategory_id2 = '0';
                 }
                 $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
                 $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]);
                 $this->sendRedirect(MOBILE_URL_CART_TOP, array(session_name() => session_id()));
                 exit;
             }
         }
     }
     // ページ送り機能用のURLを作成する。
     $objURL = new Net_URL($_SERVER['PHP_SELF']);
     foreach ($_REQUEST as $key => $value) {
         if ($key == session_name() || $key == 'pageno') {
             continue;
         }
         $objURL->addQueryString($key, mb_convert_encoding($value, 'SJIS', CHAR_CODE));
     }
     if ($this->objNavi->now_page > 1) {
         $objURL->addQueryString('pageno', $this->objNavi->now_page - 1);
         $this->tpl_previous_page = $objURL->path . '?' . $objURL->getQueryString();
     }
     if ($this->objNavi->now_page < $this->objNavi->max_page) {
         $objURL->addQueryString('pageno', $this->objNavi->now_page + 1);
         $this->tpl_next_page = $objURL->path . '?' . $objURL->getQueryString();
     }
     $this->tpl_subtitle = $tpl_subtitle;
     $this->tpl_search_mode = $tpl_search_mode;
     // 支払方法の取得
     $this->arrPayment = $this->lfGetPayment();
     // 入力情報を渡す
     $this->arrForm = $_POST;
     $this->category_id = $arrCategory_id[0];
     $this->arrSearch = $arrSearch;
     $this->tpl_mainpage = MOBILE_TEMPLATE_DIR . "products/list.tpl";
     $objView->assignobj($this);
     $objView->display(SITE_FRAME);
 }
开发者ID:khrisna,项目名称:eccubedrm,代码行数:101,代码来源:LC_Page_Products_List.php


注:本文中的Net_URL::getQueryString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。