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


PHP mb_convert_variables函数代码示例

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


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

示例1: __construct

 /**
  * コンストラクタ
  *
  */
 public function __construct()
 {
     $this->log = LoggerManager::getLogger(get_class($this));
     $request = array_merge($_POST, $_GET);
     if (get_magic_quotes_gpc()) {
         $request = $this->_stripSlashesDeep($request);
     }
     if (!ini_get("mbstring.encoding_translation") && INPUT_CODE != INTERNAL_CODE) {
         mb_convert_variables(INTERNAL_CODE, INPUT_CODE, $request);
     }
     // action:~ではじまるパラメータがあればactionMethodをセットする
     $methodName = "execute";
     $key = NULL;
     foreach ($request as $k => $val) {
         if (preg_match('/^action:(.+)$/', $k, $m)) {
             $methodName = $m[1];
             $this->log->debug("actionMethodが指定されました。 {$methodName}");
             $key = $k;
             break;
         }
     }
     $this->actionMethod = $methodName;
     if ($key != NULL) {
         unset($request[$key]);
     }
     $this->_params = $request;
     return;
 }
开发者ID:miztaka,项目名称:teeple2,代码行数:32,代码来源:Request.php

示例2: loadDataCsv

 public function loadDataCsv($fileName, $column_list, $delimiter = ",", $array_encoding = 'utf8', $import_encoding = 'sjis-win')
 {
     //保存をするのでモデルを読み込み
     try {
         $data = array();
         $csvData = array();
         $file = fopen($fileName, "r");
         while ($data = $this->fgetcsv_reg($file, 65536, $delimiter)) {
             //CSVファイルを","区切りで配列に
             mb_convert_variables($array_encoding, $import_encoding, $data);
             $csvData[] = $data;
         }
         $i = 0;
         foreach ($csvData as $line) {
             $this_data = array();
             foreach ($column_list as $k => $v) {
                 if (isset($line[$k])) {
                     //先頭と末尾の"を削除
                     $b = $line[$k];
                     //カラムの数だけセット
                     $this_data = Hash::merge($this_data, array($v => $b));
                 } else {
                     $this_data = Hash::merge($this_data, array($v => ''));
                 }
             }
             $data[$i] = $this_data;
             $i++;
         }
     } catch (\Exception $e) {
         return false;
     }
     return $data;
 }
开发者ID:satthi,项目名称:csv-combine-plugin-for-cakephp,代码行数:33,代码来源:CsvImportForm.php

示例3: _checkFile

 public function _checkFile($file)
 {
     try {
         $handle = fopen($file, "r");
         $countRow = 1;
         while (($row = fgetcsv($handle, 1000, ",")) !== FALSE) {
             mb_convert_variables("UTF-8", "auto", $row);
             $this->error = "";
             $targetrow = $this->_setContent($row);
             if ($row[0] != "room") {
                 // バリデーションチェック関数呼び出し
                 $this->_elementNum($row);
                 $this->_orBlank($row);
                 $this->_checkHyphen($row[0]);
                 $this->_integerOverZero($row[1]);
                 $this->_checkSessionCombi($row[0], $row[1]);
                 $this->_checkDate($row[3]);
                 $this->_checkTime($row[0], $row[4], $row[5], $row[3]);
                 $this->_chairPersonOne($row[6], $row[7]);
                 $this->_commentatorsCheck($row[8], $row[9]);
                 array_push($this->checkResult, array('row' => $countRow, 'content' => $targetrow, 'error' => $this->error));
                 $countRow++;
             }
         }
     } catch (Exception $e) {
         $this->rollback();
     }
 }
开发者ID:rpdw6slt,项目名称:PosTom,代码行数:28,代码来源:SchedulesController.php

示例4: read

 /**
  * ファイルの行読み込み
  * @return string|boolean 読み出した文字列、または読み込むデータがない場合はFALSEを返す
  * @access public
  */
 public function read()
 {
     $str = fgets($this->stream);
     //mb_convert_variables($this->charset, "ASCII,JIS,UTF-8,EUC-JP,SJIS-win", $str);
     mb_convert_variables($this->charset, "ASCII,JIS,SJIS-win,UTF-8,EUC-JP", $str);
     return $str;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:12,代码来源:Reader.class.php

示例5: convert

 /**
  * Return converted Response'body
  *
  * @param string       $body
  * @param string|array $metadata 'content-type'
  * $param $remains
  *
  * @return mixed
  */
 public final function convert($body, $metadata = array(), $remains = null)
 {
     if (is_string($metadata)) {
         $ctype = $metadata;
     } elseif (is_array($metadata)) {
         $ctype = isset($metadata['content-type']) ? $metadata['content-type'] : null;
     } else {
         $ctype = null;
     }
     $body = $this->_initBody($body);
     $encoding_from = $this->_encodingFrom($body, $ctype);
     // if not avilable for mbstring, using iconv
     if (!in_array($encoding_from, mb_list_encodings())) {
         $body = @iconv($encoding_from, 'UTF-8', $body);
         if (isset($remains)) {
             foreach ($remains as $k => $v) {
                 $remains[$k] = @iconv($encoding_from, 'UTF-8', $v);
             }
             return array($body, $remains);
         }
         return $body;
     }
     if (isset($remains)) {
         @mb_convert_variables('UTF-8', $encoding_from, $body, $remains);
         return array($body, $remains);
     } else {
         $body = mb_convert_encoding($body, 'UTF-8', $encoding_from);
         return $body;
     }
 }
开发者ID:bobbyshaw,项目名称:Diggin_Http_Charset,代码行数:39,代码来源:AbstractConverter.php

示例6: exportCSV

 public static function exportCSV($data)
 {
     mb_convert_variables('SJIS', 'UTF-8', $data);
     $file = fopen('csv/data.csv', 'w');
     fwrite($file, $data);
     fclose($file);
 }
开发者ID:saken21,项目名称:sudachi2,代码行数:7,代码来源:funcs.php

示例7: init_flow_handle

 public function init_flow_handle(Flow $flow)
 {
     if (Mobile::is_mobile()) {
         $vars = $flow->vars();
         mb_convert_variables('utf-8', 'utf-8,SJIS-win', $vars);
         $flow->vars($vars);
     }
 }
开发者ID:riaf,项目名称:rhaco2-repository,代码行数:8,代码来源:MobileFlowModule.php

示例8: ajaxautocompleteshowwords

 public function ajaxautocompleteshowwords($request, $response)
 {/*{{{*/
     $request->convertToGBK();
     $words = DAL::get()->queryMedicalWords4Autocomplete('searchdict', $request->word);
     mb_convert_variables('utf-8','gbk', $words);
     echo json_encode($words);  
     return parent::DIRECT_OUTPUT;
 }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:8,代码来源:indexcontroller.php

示例9: _paramConvert

 /**
  * パラメータの変換
  * @return null
  */
 private function _paramConvert()
 {
     if (sfJpMobile::isDocomo() || sfJpMobile::isKddi()) {
         foreach ($this->getContext()->getRequest()->getParameterHolder()->getAll() as $key => $val) {
             mb_convert_variables('UTF-8', 'SJIS-win,UTF-8', $val);
             $this->getContext()->getRequest()->setParameter($key, $val);
         }
     }
 }
开发者ID:pontuyo,项目名称:takutomo-mixi-appli,代码行数:13,代码来源:sfJpMobileFilter.class.php

示例10: ajaxGetAttachmentData

	public function ajaxGetAttachmentData($request, $response)
	{/*{{{*/
		$attachment = DAL::get()->find('Attachment', $request->aid);
		$result['filename'] = $attachment->fileName;
		$result['atturl'] =  TuClient::getInstance()->getUrl($attachment->filePath);
        mb_convert_variables('utf8', 'gbk', $result); 
		echo json_encode($result);
		return parent::DIRECT_OUTPUT;
	}/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:9,代码来源:attachcontroller.php

示例11: preforward

 /**
  *  Jsonを出力する
  *
  *  @access public
  *  @param  array  $encode_param  出力するJSONにエンコードする値
  */
 function preforward($encode_param = array())
 {
     $client_enc = $this->ctl->getClientEncoding();
     if (mb_enabled() && strcasecmp('UTF-8', $client_enc) != 0) {
         mb_convert_variables('UTF-8', $client_enc, $encode_param);
     }
     $encoded_param = json_encode($encode_param);
     $this->header(array('Content-Type' => 'application/json; charset=UTF-8'));
     echo $encoded_param;
 }
开发者ID:riaf,项目名称:ethna,代码行数:16,代码来源:Json.php

示例12: execute

	function execute(&$controller, &$xoopsUser)
	{
		$filename = sprintf('%s User data List.csv', $GLOBALS['xoopsConfig']['sitename']);
		$text = '';
		$field_line = '';
		
		$user_handler =& $this->_getHandler();
		$criteria = new CriteriaElement();
		$criteria->setSort('uid');
		$users = $user_handler->getObjects($criteria);
		if (!$users || count($users)==0){
			return USER_FRAME_VIEW_INDEX;
		}
		foreach ($users[0]->gets() as $key=>$var){
			$_f = '_MD_USER_LANG_'.strtoupper($key);
			$field_line .= (defined($_f) ? constant($_f) : $key).",";
		}
		$field_line .= "\n";
		
		foreach ($users as $u){
			$user_data = '';
			foreach ($u->gets() as $key=>$value){
				switch ($key){
				  case 'user_regdate':
				  case 'last_login':
					$value = $value ? formatTimestamp($value, 'Y/n/j H:i') : '';
					break;
				  default:
				}
				if (preg_match('/[,"\r\n]/', $value)) {
					$value = preg_replace('/"/', "\"\"", $value);
					$value = "\"$value\"";
				}
				$user_data .= $value . ',';
			}
			$text .= trim($user_data, ',')."\n";
		}
		$text = $field_line.$text;
		
		/// japanese 
		if (strncasecmp($GLOBALS['xoopsConfig']['language'], 'ja', 2)===0){
			mb_convert_variables('SJIS', _CHARSET, $text);
		}
		
		if( preg_match('/firefox/i' , xoops_getenv('HTTP_USER_AGENT')) ){
			header("Content-Type: application/x-csv");
		}else{
			header("Content-Type: application/vnd.ms-excel");
		}
		
		
		header("Content-Disposition: attachment ; filename=\"{$filename}\"") ;
		exit($text);
	}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:54,代码来源:UserDataDownloadAction.class.php

示例13: preforward

 /**
  *  Jsonを出力する
  *  @access public
  *  @param  array  $encode_param  出力するJSONにエンコードする値
  *  @see Admin_ViewClass::preforward
  */
 function preforward($encode_param)
 {
     $client_enc = $this->ctl->getClientEncoding();
     if (mb_enabled() && strcasecmp('UTF-8', $client_enc) != 0) {
         mb_convert_variables('UTF-8', $client_enc, $encode_param);
     }
     $this->jsonI18n($encode_param);
     $encoded_param = json_encode($encode_param);
     header('Content-Type: application/json; charset=UTF-8');
     echo $encoded_param;
     exit;
 }
开发者ID:weiweiabc109,项目名称:test_project1,代码行数:18,代码来源:Json.php

示例14: initialize

 function initialize(&$controller)
 {
     if ($this->isMobile()) {
         if (isset($controller->params['url'][Configure::read('Session.cookie')])) {
             $this->Session->id($controller->params['url'][Configure::read('Session.cookie')]);
             $this->Session->renew();
         }
         if ($controller->data) {
             mb_convert_variables('UTF-8', 'SJIS-win', $controller->data);
         }
     }
 }
开发者ID:slywalker,项目名称:mobile_kit,代码行数:12,代码来源:render.php

示例15: request

 /**
  * リソースリクエスト実行
  *
  * リモートURLにアクセスしてRSSだったら配列に、
  * そうでなかったらHTTP Body文字列をリソースとして扱います。
  *
  * @return BEAR_Ro
  * @throws BEAR_Resource_Execute_Exception
  */
 public function request()
 {
     $reqMethod = array();
     $reqMethod[BEAR_Resource::METHOD_CREATE] = HTTP_Request2::METHOD_POST;
     $reqMethod[BEAR_Resource::METHOD_READ] = HTTP_Request2::METHOD_GET;
     $reqMethod[BEAR_Resource::METHOD_UPDATE] = HTTP_Request2::METHOD_PUT;
     $reqMethod[BEAR_Resource::METHOD_DELETE] = HTTP_Request2::METHOD_DELETE;
     assert(isset($reqMethod[$this->_config['method']]));
     try {
         // 引数以降省略可能  config で proxy とかも設定可能
         $request = new HTTP_Request2($this->_config['uri'], $reqMethod[$this->_config['method']]);
         $request->setHeader("user-agent", 'BEAR/' . BEAR::VERSION);
         $request->setConfig("follow_redirects", true);
         if ($this->_config['method'] === BEAR_Resource::METHOD_CREATE || $this->_config['method'] === BEAR_Resource::METHOD_UPDATE) {
             foreach ($this->_config['values'] as $key => $value) {
                 $request->addPostParameter($key, $value);
             }
         }
         $response = $request->send();
         $code = $response->getStatus();
         $headers = $response->getHeader();
         if ($code == 200) {
             $body = $response->getBody();
         } else {
             $info = array('code' => $code, 'headers' => $headers);
             throw $this->_exception($response->getBody(), $info);
         }
     } catch (HTTP_Request2_Exception $e) {
         throw $this->_exception($e->getMessage());
     } catch (Exception $e) {
         throw $this->_exception($e->getMessage());
     }
     $rss = new XML_RSS($body, 'utf-8', 'utf-8');
     PEAR::setErrorHandling(PEAR_ERROR_RETURN);
     // @todo Panda::setPearErrorHandling(仮称)に変更しエラーを画面化しないようにする
     $rss->parse();
     $items = $rss->getItems();
     if (is_array($items) && count($items) > 0) {
         $body = $items;
         $headers = $rss->getChannelInfo();
         $headers['type'] = 'rss';
     } else {
         $headers['type'] = 'string';
         $body = array($body);
     }
     // UTF-8に
     $encode = mb_convert_variables('UTF-8', 'auto', $body);
     $ro = BEAR::factory('BEAR_Ro')->setBody($body)->setHeaders($headers);
     /* @var $ro BEAR_Ro */
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array('Panda', 'onPearError'));
     return $ro;
 }
开发者ID:ryo88c,项目名称:BEAR.Saturday,代码行数:61,代码来源:Http.php


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