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


PHP mb_parse_str函数代码示例

本文整理汇总了PHP中mb_parse_str函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_parse_str函数的具体用法?PHP mb_parse_str怎么用?PHP mb_parse_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getPutParameters

 private static function getPutParameters($input)
 {
     $putdata = $input;
     if (function_exists('mb_parse_str')) {
         mb_parse_str($putdata, $outputdata);
     } else {
         parse_str($putdata, $outputdata);
     }
     return $outputdata;
 }
开发者ID:KrisJordan,项目名称:recess,代码行数:10,代码来源:Environment.class.php

示例2: getInputData

 public static function getInputData()
 {
     if (self::$inputData === null) {
         $inputData = [];
         $rawInput = file_get_contents('php://input');
         if (!empty($rawInput)) {
             mb_parse_str($rawInput, $inputData);
         }
         self::$inputData = $inputData;
     }
     return self::$inputData;
 }
开发者ID:pavel-tashev,项目名称:APIJet,代码行数:12,代码来源:Request.php

示例3: f_contents

function f_contents(&$text){
    $phrase = 'СТРАНИЦА';

    if (mb_strpos($text, $phrase) === false) { return true; }

    $regex = '/{('. $phrase .'=)\s*(.*?)}/ui';
    
    $matches = array();
    preg_match_all($regex, $text, $matches, PREG_SET_ORDER);
    
    $GLOBALS['pt'] = array();
    
    foreach ($matches as $elm) {
            $elm[0] = str_replace('{', '', $elm[0]);
            $elm[0] = str_replace('}', '', $elm[0]);
            
            mb_parse_str($elm[0], $args);
            
            $title = @$args[$phrase];
            
            if ($title) {
                $GLOBALS['pt'][] = $title;
            }
            $text = str_replace('{'.$phrase.'='.$title.'}', '', $text );
    }

    return true;
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:28,代码来源:filter.php

示例4: getParsedBody

 /**
  * Retorna o conteudo do request parseado para GET, POST, PUT e DELETE
  * ou lança uma exceção caso o tipo de content-type seja inválido
  * @return array
  */
 public function getParsedBody()
 {
     if (!in_array($this->getMethod(), ['GET', 'POST'])) {
         if ($this->getContentType() == 'application/x-www-form-urlencoded') {
             $input_contents = file_get_contents("php://input");
             if (function_exists('mb_parse_str')) {
                 mb_parse_str($input_contents, $post_vars);
             } else {
                 parse_str($input_contents, $post_vars);
             }
             if (count($_GET) > 0) {
                 $post_vars = array_merge($post_vars, $_GET);
             }
             return $post_vars;
         } else {
             throw new \UnexpectedValueException('Content-type não aceito');
         }
     } elseif ($this->getMethod() == 'POST') {
         if (count($_GET) > 0) {
             $_POST = array_merge($_POST, $_GET);
         }
         return $_POST;
     } elseif ($this->getMethod() == 'GET') {
         return $_GET;
     }
 }
开发者ID:lukasdev,项目名称:drouter,代码行数:31,代码来源:Request.php

示例5: f_includes

	function f_includes(&$text){

        $phrase = 'ФАЙЛ';

		if (mb_strpos($text, $phrase) === false){
			return true;
		}

 		$regex = '/{('.$phrase.'=)\s*(.*?)}/i';
		$matches = array();
		preg_match_all( $regex, $text, $matches, PREG_SET_ORDER );
		foreach ($matches as $elm) {
			$elm[0] = str_replace('{', '', $elm[0]);
			$elm[0] = str_replace('}', '', $elm[0]);
			mb_parse_str( $elm[0], $args );
			$file=@$args[$phrase];
			if ($file){
				$output = getLink($file);
			} else { $output = ''; }
			$text = str_replace('{'.$phrase.'='.$file.'}', $output, $text );
		}

		return true;

	}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:25,代码来源:filter.php

示例6: f_banners

function f_banners(&$text)
{
    $phrase = 'БАННЕР';
    if (mb_strpos($text, $phrase) === false) {
        return true;
    }
    if (!cmsCore::getInstance()->isComponentEnable('banners')) {
        return true;
    }
    $regex = '/{(' . $phrase . '=)\\s*(.*?)}/i';
    $matches = array();
    preg_match_all($regex, $text, $matches, PREG_SET_ORDER);
    if (!$matches) {
        return true;
    }
    cmsCore::loadModel('banners');
    foreach ($matches as $elm) {
        $elm[0] = str_replace('{', '', $elm[0]);
        $elm[0] = str_replace('}', '', $elm[0]);
        mb_parse_str($elm[0], $args);
        $position = @$args[$phrase];
        if ($position) {
            $output = cms_model_banners::getBannerHTML($position);
        } else {
            $output = '';
        }
        $text = str_replace('{' . $phrase . '=' . $position . '}', $output, $text);
    }
    return true;
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:30,代码来源:filter.php

示例7: elgg_parse_str

/**
 * Parses a string using mb_parse_str() if available.
 * NOTE: This differs from parse_str() by returning the results
 * instead of placing them in the local scope!
 *
 * @param str $str
 * @return array
 */
function elgg_parse_str($str)
{
    if (is_callable('mb_parse_str')) {
        mb_parse_str($str, $results);
    } else {
        parse_str($str, $results);
    }
    return $results;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:17,代码来源:mb_wrapper.php

示例8: queryString

 public static function queryString()
 {
     $queryString = array();
     if (function_exists('mb_parse_str')) {
         mb_parse_str($_SERVER['QUERY_STRING'], $queryString);
     } else {
         parse_str($_SERVER['QUERY_STRING'], $queryString);
     }
     return $queryString;
 }
开发者ID:smilezino,项目名称:placehold,代码行数:10,代码来源:Config.php

示例9: parseLinkUrl

 protected function parseLinkUrl($url)
 {
     try {
         $urlParams = mb_substr($url, mb_strpos($url, '?') + 1);
         $array = [];
         mb_parse_str(htmlspecialchars_decode($urlParams), $array);
         if (!filter_var($array['q'], FILTER_VALIDATE_URL)) {
             throw new GoogleParserException($array['q'] . ' invalid url');
         }
         return $array['q'];
     } catch (GoogleParserException $e) {
         throw $e;
     }
 }
开发者ID:nekrasovdmytro,项目名称:finder,代码行数:14,代码来源:Url.php

示例10: getRestParams

 /**
  * Returns rest request parameters.
  * @return array the request parameters
  */
 public function getRestParams()
 {
     $result = [];
     $httpMethod = array('get', 'put', 'delete', 'put', 'patch', 'options');
     if (!isset($_SERVER['REQUEST_METHOD']) || !in_array(strtolower($_SERVER['REQUEST_METHOD']), $httpMethod)) {
         return $result;
     }
     if (function_exists('mb_parse_str')) {
         mb_parse_str(file_get_contents('php://input'), $result);
     } else {
         parse_str(file_get_contents('php://input'), $result);
     }
     return $result;
 }
开发者ID:superbogy,项目名称:cargo,代码行数:18,代码来源:HttpRequest.php

示例11: getInputParams

 /**
  * Function fetch params from php://input.
  * @return array HTTP params
  */
 public function getInputParams()
 {
     $result = array();
     $rawBody = Yii::app()->request->rawBody;
     if (is_null($result = json_decode($rawBody, true))) {
         if (function_exists('mb_parse_str')) {
             mb_parse_str(Yii::app()->request->rawBody, $result);
         } else {
             parse_str(Yii::app()->request->rawBody, $result);
         }
     }
     if (!is_array($result) || empty($result) && !empty($_POST)) {
         $result = $_POST;
     }
     return $result;
 }
开发者ID:goodnickoff,项目名称:yiirestmodel,代码行数:20,代码来源:ApiBaseController.php

示例12: getInput

 public function getInput(string $method) : array
 {
     if ($method == 'GET') {
         return array('data' => json_decode($_GET, true));
     } else {
         if ($method == 'POST') {
             return array('data' => json_decode($_POST, true));
         } else {
             if ($method == 'PUT') {
                 mb_parse_str(file_get_contents("php://input"), $result);
                 return array('data' => json_decode($result, true));
             } else {
                 throw new \Hx\Http\HttpException("UrlEncoded input decoder not support request method <{$method}>");
             }
         }
     }
 }
开发者ID:guinso,项目名称:hx-http,代码行数:17,代码来源:UrlEncoded.php

示例13: replace_text

function replace_text($text, $phrase)
{
    $regex = '/{(' . $phrase['title'] . '=)\\s*(.*?)}/ui';
    $matches = array();
    preg_match_all($regex, $text, $matches, PREG_SET_ORDER);
    foreach ($matches as $elm) {
        $elm[0] = str_replace(array('{', '}'), '', $elm[0]);
        mb_parse_str($elm[0], $args);
        $arg = @$args[$phrase['title']];
        if ($arg) {
            $output = call_user_func($phrase['function'], $arg);
        } else {
            $output = '';
        }
        $text = str_replace('{' . $phrase['title'] . '=' . $arg . '}', $output, $text);
    }
    return $text;
}
开发者ID:deltas1,项目名称:icms1,代码行数:18,代码来源:filter.php

示例14: createUrl

 /**
  * Генерирует URL согласно настройкам или локальному режиму
  *
  * @param string $queryString
  * @param bool|array $mode
  *
  * @return string
  */
 public function createUrl($queryString, $mode = false)
 {
     if (substr($queryString, 0, 4) === 'http') {
         return $queryString;
     }
     $queryString = trim($queryString, '/');
     if (is_array($mode) && !empty($this->config['url_manager'])) {
         $config = array_merge($this->config['url_manager'], $mode);
     } elseif (!is_array($mode) && !empty($this->config['url_manager'])) {
         $config = $this->config['url_manager'];
     }
     $protocol = !empty($config['https']) ? 'https://' : 'http://';
     $hostName = $this->request->getHostName();
     $scriptName = null;
     if (!empty($config['show_script'])) {
         $query = trim($_SERVER['PHP_SELF'], '/');
         $scriptName = '/' . explode('/', $query)[0];
     }
     if (true === $mode) {
         $basePath = $protocol . $hostName . $scriptName;
     } elseif (false === $mode) {
         $basePath = $scriptName;
     } else {
         $basePath = isset($config['absolute']) && true === $config['absolute'] ? $protocol . $hostName . $scriptName : $scriptName;
     }
     if (isset($config['pretty']) && false === $config['pretty']) {
         if ($queryString[0] === '?') {
             return $basePath . '?' . ltrim($queryString, '?');
         } else {
             $param = $this->parser->parseRoutes($queryString);
             return $basePath . '?' . http_build_query($param);
         }
     } else {
         if ($queryString[0] !== '?') {
             return $basePath . '/' . $queryString;
         } else {
             mb_parse_str($queryString, $param);
             $param = $this->router->hashFromParam($param);
             $queryString = implode('/', $param);
             return $basePath . '/' . $queryString;
         }
     }
 }
开发者ID:abc-framework,项目名称:abc-framework,代码行数:51,代码来源:UrlManager.php

示例15: f_filelink

function f_filelink(&$text)
{
    $phrase = 'СКАЧАТЬ';
    //echo "<pre>"; var_dump($text);
    if (mb_strpos($text, $phrase) === false) {
        return true;
    }
    //$regex = '/{('.$phrase.'=)\s*(.*?)---(.*?)}/i';
    $regex = '/{(' . $phrase . '=\\s*.*?)---(.*?)}/i';
    //$regex = '/{('.$phrase.'=)\s*(.*?)}/i';
    $matches = array();
    preg_match_all($regex, $text, $matches, PREG_SET_ORDER);
    foreach ($matches as $elm) {
        //echo "<pre>"; var_dump($matches);
        /* $elm[0] = str_replace('{', '', $elm[0]);
        			$elm[0] = str_replace('}', '', $elm[0]); */
        //mb_parse_str( $elm[0], $args );
        mb_parse_str($elm[1], $args);
        $file = @$args[$phrase];
        if ($file) {
            // echo "<pre>"; var_dump($file);
            $output = getDownLoadLink($file, $elm[2]);
        } else {
            $output = '';
        }
        $text = str_replace('{' . $phrase . '=' . $file . '---' . $elm[2] . '}', $output, $text);
        /*echo "<pre>"; var_dump($elm[2]);
        		if($elm[2]){
        			$text = str_replace('{'.$phrase.'='.$file.'---'.$elm[2].'}', $output, $text );
        		}
        		else{
        			$text = str_replace('{'.$phrase.'='.$file.'}', $output, $text );
        		}*/
    }
    return true;
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:36,代码来源:filter.php


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