亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

direktori cari
歡迎 目錄 快速參考圖 基本信息 服務器要求 許可協(xié)議 變更記錄 關于CodeIgniter 安裝 下載 CodeIgniter 安裝指導 從老版本升級 疑難解答 介紹 開始 CodeIgniter 是什么? CodeIgniter 速記表 支持特性 應用程序流程圖 模型-視圖-控制器 架構目標 教程 內容提要 加載靜態(tài)內容 創(chuàng)建新聞條目 讀取新聞條目 結束語 常規(guī)主題 CodeIgniter URL 控制器 保留字 視圖 模型 輔助函數(shù) 使用 CodeIgniter 類庫 創(chuàng)建你自己的類庫 使用 CodeIgniter 適配器 創(chuàng)建適配器 創(chuàng)建核心系統(tǒng)類 鉤子 - 擴展框架的核心 自動裝載資源 公共函數(shù) URI 路由 錯誤處理 緩存 調試應用程序 以CLI方式運行 管理應用程序 處理多環(huán)境 PHP替代語法 安全 開發(fā)規(guī)范 類庫參考 基準測試類 日歷類 購物車類 配置類 Email 類 加密類 文件上傳類 表單驗證詳解 FTP 類 圖像處理類 輸入類 Javascript 類 語言類 裝載類 遷移類 輸出類 分頁類 模板解析器類 安全類 Session 類 HTML 表格類 引用通告類 排版類 單元測試類 URI 類 User-Agent 類 表單驗證 XML-RPC 和 XML-RPC 服務器 Zip 編碼類 緩存適配器 適配器參考 適配器 數(shù)據(jù)庫類 Active Record 類 數(shù)據(jù)庫緩存類 自定義函數(shù)調用 數(shù)據(jù)庫配置 連接你的數(shù)據(jù)庫 數(shù)據(jù)庫快速入門例子代碼 字段數(shù)據(jù) 數(shù)據(jù)庫維護類 查詢輔助函數(shù) 數(shù)據(jù)庫類 查詢 生成查詢記錄集 表數(shù)據(jù) 事務 數(shù)據(jù)庫工具類 JavaScript類 輔助函數(shù)參考 數(shù)組輔助函數(shù) CAPTCHA 輔助函數(shù) Cookie Helper 日期輔助函數(shù) 目錄輔助函數(shù) 下載輔助函數(shù) Email 輔助函數(shù) 文件輔助函數(shù) 表單輔助函數(shù) HTML輔助函數(shù) Inflector 輔助函數(shù) 語言輔助函數(shù) 數(shù)字輔助函數(shù) 路徑輔助函數(shù) 安全輔助函數(shù) 表情輔助函數(shù) 字符串輔助函數(shù) 文本輔助函數(shù) 排版輔助函數(shù) URL 輔助函數(shù) XML 輔助函數(shù)
watak

CodeIgniter 用戶指南 版本 2.1.0

編輯文檔、查看近期更改請 登錄 或 注冊  找回密碼
查看原文

字符串輔助函數(shù)

該字符串輔助函數(shù)為你提供對字符串類型的各種函數(shù)。

裝載字符串輔助函數(shù)

采用如下方式裝載該輔助函數(shù):

$this->load->helper('string');

可用函數(shù)如下:

random_string()

根據(jù)你所指定的類型和長度產(chǎn)生一個隨機字符串。可用于生成密碼串或隨機字串。

第一個參數(shù)指定字符串類型,第二個參數(shù)指定其長度。以下為可選字符串類型:

alpha, alunum, numeric, nozero, unique, md5, encrypt and sha1
  • alpha:? A string with lower and uppercase letters only.
  • alnum:? 含有大小寫字母以及數(shù)字。
  • numeric:? 數(shù)字字符串。
  • nozero:? 不含零的數(shù)字字符串。
  • unique:? 用 MD5 and uniqid()加密的字符串。注意:第二個長度參數(shù)在這種類型無效。均返回一個32位長度的字符串。
  • sha1:? An encrypted random number based on do_hash() from the security helper.

范例:

echo random_string('alnum', 16);

increment_string()

Increments a string by appending a number to it or increasing the number. Useful for creating "copies" or a file or duplicating database content which has unique titles or slugs.

Usage example:

echo increment_string('file', '_'); // "file_1"
echo increment_string('file', '-', 2); // "file-2"
echo increment_string('file-4'); // "file-5"

alternator()

當執(zhí)行一個循環(huán)時,讓兩個或兩個以上的條目輪換使用。范例:

for ($i = 0; $i {
????echo alternator('string one', 'string two');
}

你可以任意添加條目的數(shù)量,每一次循環(huán)后下一個條目將成為返回值。

for ($i = 0; $i {
????echo alternator('one', 'two', 'three', 'four', 'five');
}

注意:為了讓多次調用該函數(shù)簡單方便,調用該函數(shù)時請不要帶上實參進行重預置。

repeater()

重復生成你所提交的數(shù)據(jù)。范例:

$string = "\n";
echo repeater($string, 30);

上面的例子將會產(chǎn)生30個空行。

reduce_double_slashes()

將字符串中的雙斜線(//)轉換為單斜線(/),但不轉換形如(http://)的雙斜線。范例:

$string = "http://example.com//index.php";
echo reduce_double_slashes($string); // results in "http://example.com/index.php"

trim_slashes()

去掉任何出現(xiàn)在字符串開頭或結尾的斜線。范例:

$string = "/this/that/theother/";
echo trim_slashes($string); // results in this/that/theother

reduce_multiples()

去掉多余的一個緊接著一個重復出現(xiàn)的特殊字符。范例:

$string="Fred, Bill,, Joe, Jimmy";
$string=reduce_multiples($string,","); //results in "Fred, Bill, Joe, Jimmy"

該函數(shù)可以接受如下的形參: reduce_multiples(string: text to search in, string: character to reduce, boolean: whether to remove the character from the front and end of the string) 第一個形參用于傳送你所要去掉重復的字符串。第二個形參用于傳送你所要去掉的字符。第三個形參默認為 False。如果為True將會去掉出現(xiàn)在字符串開頭或結尾的字符(即使字符不重復也去掉)。范例: $string=",Fred, Bill,, Joe, Jimmy,";
$string=reduce_multiples($string, ", ", TRUE); //results in "Fred, Bill, Joe, Jimmy"

quotes_to_entities()

將字符串中的單引號和雙引號轉換為相應的 HTML 字符表示。范例:

$string="Joe's \\\\"dinner\"";
$string=quotes_to_entities($string); //results in "Joe's "dinner""

strip_quotes()

去掉字符串中的單引號和雙引號。范例:

$string="Joe's \\\\"dinner\"";
$string=strip_quotes($string); //results in "Joes dinner"

?

翻譯貢獻者: Hex, kkorange
最后修改: 2012-02-06 00:00:18
Artikel sebelumnya: Artikel seterusnya: