• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mb_parse_str函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: getPostCut

 public function getPostCut($post_content)
 {
     $regex = '/\\[(cut=)\\s*(.*?)\\]/ui';
     $matches = array();
     preg_match_all($regex, $post_content, $matches, PREG_SET_ORDER);
     if (is_array($matches)) {
         $elm = $matches[0];
         $elm[0] = str_replace('[', '', $elm[0]);
         $elm[0] = str_replace(']', '', $elm[0]);
         mb_parse_str($elm[0], $args);
         $cut .= '[cut=' . $args['cut'] . '...]';
     }
     return $cut;
 }
开发者ID:deltas1,项目名称:icms1,代码行数:14,代码来源:blog.class.php


示例17: getBody

 /**
  * Retrieve the body of the request.
  *
  * @param bool $raw return body in it's raw format
  * @return string
  */
 public function getBody($raw = true)
 {
     if (!$this->body) {
         $this->body = file_get_contents('php://input');
     }
     if (!$raw) {
         $type = $this->getContentType();
         if (in_array($type, $this->contentTypes['form'])) {
             return mb_parse_str($this->body);
         } elseif (in_array($type, $this->contentTypes['json'])) {
             return json_decode($this->body);
         } elseif (in_array($type, $this->contentTypes['xml'])) {
             return simplexml_load_string($this->body);
         }
     }
     return $this->body;
 }
开发者ID:Robert-Xie,项目名称:php-framework-benchmark,代码行数:23,代码来源:Standard.php


示例18: setDefaultParsedBody

 /**
  * Set Default Parsed Body
  *
  * @return void
  */
 protected function setDefaultParsedBody()
 {
     if (in_array($this->getHeaderLine('Content-Type'), ['application/x-www-form-urlencoded', 'multipart/form-data']) && $this->method === 'POST') {
         $this->parsed_body = $_POST;
     } else {
         mb_parse_str($this->getBody()->getContents(), $parsed_body);
         $this->parsed_body = $parsed_body;
     }
 }
开发者ID:jwslink,项目名称:restfulapi,代码行数:14,代码来源:Request.php


示例19: query

 /**
  * Пагинация в query string (/?page=2)
  *
  * @param string $name - имя параметра пагинации
  */
 public function query($name = 'page')
 {
     $query_string = Request::query();
     mb_parse_str($query_string, $query_array);
     $path_string = Request::path();
     $list_array = array();
     foreach ($this->result['list'] as $number) {
         $outputList = array();
         $outputList['number'] = $number;
         if ($number == 1) {
             $query_array = array_delete_key($query_array, $name);
             $query_string = http_build_query($query_array);
             $outputList['url'] = $query_string != "" ? $path_string . "?" . $query_string : $path_string;
         } else {
             $query_array[$name] = $number;
             $query_string = http_build_query($query_array);
             $outputList['url'] = $path_string . "?" . $query_string;
         }
         $list_array[] = $outputList;
     }
     $this->result['list'] = $list_array;
     //-----
     if ($this->result['current'] == 1 or $this->result['prev'] == 1) {
         $query_array = array_delete_key($query_array, $name);
         $query_string = http_build_query($query_array);
         $this->result['prev_url'] = $query_string != "" ? $path_string . "?" . $query_string : $path_string;
     } else {
         $query_array[$name] = $this->result['prev'];
         $query_string = http_build_query($query_array);
         $this->result['prev_url'] = $path_string . "?" . $query_string;
     }
     //-----
     if ($this->result['current'] == 1) {
         $query_array = array_delete_key($query_array, $name);
         $query_string = http_build_query($query_array);
         $this->result['current_url'] = $query_string != "" ? $path_string . "?" . $query_string : $path_string;
     } else {
         $query_array[$name] = $this->result['current'];
         $query_string = http_build_query($query_array);
         $this->result['current_url'] = $path_string . "?" . $query_string;
     }
     //-----
     if ($this->result['current'] == $this->result['total']) {
         $query_array[$name] = $this->result['current'];
         $query_string = http_build_query($query_array);
     } else {
         $query_array[$name] = $this->result['next'];
         $query_string = http_build_query($query_array);
     }
     $this->result['next_url'] = $path_string . "?" . $query_string;
     //-----
     $query_array = array_delete_key($query_array, $name);
     $query_string = http_build_query($query_array);
     $this->result['first_url'] = $query_string != "" ? $path_string . "?" . $query_string : $path_string;
     if ($this->result['total'] > 1) {
         $query_array[$name] = $this->result['total'];
         $query_string = http_build_query($query_array);
         $this->result['last_url'] = $path_string . "?" . $query_string;
     } else {
         $this->result['last_url'] = $this->result['first_url'];
     }
     //-----
     return $this->result;
 }
开发者ID:AlexanderGrom,项目名称:knee,代码行数:69,代码来源:make.php


示例20: parseQueryString

 /**
  * Разбирает в массив QUERY_STRING
  *
  * @return array
  */
 protected function parseQueryString()
 {
     $queryString = urldecode($_SERVER['QUERY_STRING']);
     mb_parse_str($queryString, $result);
     return $result;
 }
开发者ID:abc-framework,项目名称:abc-framework,代码行数:11,代码来源:Request.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mb_regex_encoding函数代码示例发布时间:2022-05-15
下一篇:
PHP mb_orig_substr函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap