CI中遇到的小問題(積累中 )

2021-09-01 01:44:37 字數 817 閱讀 4745

1、[b]$this->uri->segment();[/b]

//獲得url上的引數

//比如:...index.php/controller/index/3

$this->uri->segment(3);就是url上從index.php開始往後數,/劃分,例子上就是得到的3

2、[b]site_url()[/b]

site_url("index/index");//重定向url,第乙個index為控制層class名,第二個為第乙個呼叫class中的某個function名,在此之後可以追加此function要用到的引數,如「/544」供此函式使用。

3、session的使用

//第一步

$condition=array();//比如要用到的乙個陣列

$sess_data[__class__.'.'.__function__.'.'."condition"]=$condition;//將陣列存入會話

//第二步

$this->session->set_userdata($sess_data);//從會話中讀取資料

4、要顯示的資料量太大時,可以在控制層頂部設定如:ini_set("memory_limit", "200m");

5、啟用分析器(除錯,優化) $this->output->enable_profiler(true); (可以在你的mysql沒做到優化的情況下關閉)

html 中遇到的小問題

html 如果輸入的內容長度大於 長度 那麼 也會跟著拉長,設定固定寬度後 輸入超長內容 仍然會拉長 解決辦法 獲取下拉列表的值 獲取下拉列表選中項的文字 function getselectedtext name 獲取下拉列表選中項的值 function getselectedvalue name...

easyui中遇到的小問題

工作的時候遇到一些小問題,下面記錄一下 1 獲取系統當前時間 獲取系統當前時間 function getnowformatdate if strdate 0 strdate 9 var currentdate date.getfullyear seperator1 month seperator1 ...

開發中遇到的小問題

1 多種資料庫型別時如何轉換字串排序,甚至是替換字元,可以使用cast replace column,as decimal select cast replace column,as decimal from table order by cast replace column,as decimal...