@@ -100,8 +100,8 @@ <h2>random_element()</h2>
100100
101101< h2 > elements()</ h2 >
102102
103- < p > Lets you fetch a number of items from an array. The function tests whether each of the array indices is set. If an index does not exist
104- it is set to FALSE, or whatever you've specified as the default value via the third parameter. Example: </ p >
103+ < p > 讓你從陣列中取回多個指定的元素。給定一個陣列,其中存放欲取得的陣列索引,此函式將檢查是否每個陣列索引都存在。
104+ 回傳值是一個含有你指定索引的陣列及其值,若有不存在的索引,則其值將設定為預設值FALSE。亦可透過第三個參數來指定其預設值。範例如下: </ p >
105105
106106< code >
107107$array = array(< br />
@@ -114,7 +114,7 @@ <h2>elements()</h2>
114114$my_shape = elements(array('color', 'shape', 'height'), $array);< br />
115115</ code >
116116
117- < p > The above will return the following array: </ p >
117+ < p > 以上程式將回傳下面的陣列: </ p >
118118
119119< code >
120120array(< br />
@@ -124,13 +124,13 @@ <h2>elements()</h2>
124124);
125125</ code >
126126
127- < p > You can set the third parameter to any default value you like: </ p >
127+ < p > 你可以由第三個參數設定預設值,當索引不存在時會套用預設值: </ p >
128128
129129< code >
130130$my_shape = elements(array('color', 'shape', 'height'), $array, NULL);< br />
131131</ code >
132132
133- < p > The above will return the following array: </ p >
133+ < p > 以上程式將回傳下面的陣列: </ p >
134134
135135< code >
136136array(< br />
@@ -140,16 +140,15 @@ <h2>elements()</h2>
140140);
141141</ code >
142142
143- < p > This is useful when sending the < kbd > $_POST</ kbd > array to one of your Models. This prevents users from
144- sending additional POST data to be entered into your tables:</ p >
143+ < p > 當你想要將< kbd > $_POST</ kbd > 陣列傳送給Model時,這將會很有用。它可以避免傳送多餘的資料給你的Model:</ p >
145144
146145< code >
147146$this-> load-> model('post_model');< br />
148147< br />
149148$this-> post_model-> update(elements(array('id', 'title', 'content'), $_POST));
150149</ code >
151150
152- < p > This ensures that only the id, title and content fields are sent to be updated. </ p >
151+ < p > 這可以確保僅有id,title及content的值會被送出及更新。 </ p >
153152
154153
155154</ div >
0 commit comments