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


PHP UTF8::remove_invisible_characters方法代碼示例

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


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

示例1: _clean_input_data

 /**
  * Clean Input Data
  *
  * Internal method that aids in escaping data and
  * standardizing newline characters to PHP_EOL.
  *
  * @param	string|string[]	$str	Input string(s)
  * @return	string
  */
 protected function _clean_input_data($str)
 {
     if (is_array($str)) {
         $new_array = array();
         foreach (array_keys($str) as $key) {
             $new_array[$this->_clean_input_keys($key)] = $this->_clean_input_data($str[$key]);
         }
         return $new_array;
     }
     /* We strip slashes if magic quotes is on to keep things consistent
     
     		   NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and
     		         it will probably not exist in future versions at all.
     		*/
     if (!Core::isPHP('5.4') && get_magic_quotes_gpc()) {
         $str = stripslashes($str);
     }
     // Clean UTF-8 if supported
     if (UTF8_ENABLED === TRUE) {
         $str = $this->factory->utf8->clean_string($str);
     }
     // Remove control characters
     $str = UTF8::remove_invisible_characters($str, FALSE);
     // Standardize newlines if needed
     if ($this->_standardize_newlines === TRUE) {
         return preg_replace('/(?:\\r\\n|[\\r\\n])/', PHP_EOL, $str);
     }
     return $str;
 }
開發者ID:fuzeworks,項目名稱:core,代碼行數:38,代碼來源:Input.php

示例2: sanitize_filename

 /**
  * Sanitize Filename
  *
  * @param	string	$str		Input file name
  * @param 	bool	$relative_path	Whether to preserve paths
  * @return	string
  */
 public function sanitize_filename($str, $relative_path = FALSE)
 {
     $bad = $this->filename_bad_chars;
     if (!$relative_path) {
         $bad[] = './';
         $bad[] = '/';
     }
     $str = UTF8::remove_invisible_characters($str, FALSE);
     do {
         $old = $str;
         $str = str_replace($bad, '', $str);
     } while ($old !== $str);
     return stripslashes($str);
 }
開發者ID:fuzeworks,項目名稱:core,代碼行數:21,代碼來源:Security.php


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